Regular |
|
Joined: Thu Feb 19, 2004 4:48 am Posts: 62
|
I wonder, if it is possible to change the schema at runtime without restarting the hibernate application? Here is what I want to do:
- programmatically create a new table
- dynamically create a new class
- compile the class using javac.compile(args);
- create a <class>.hbm.xml
- get a handle to the new class with Class clazz = Class.forName(classname);
- *somehow* tell hibernate to use this new class without shutting it down
Is it possible to simply call
cfg.addAnnotatedClass(clazz);
and than call .buildSessionFactory(); again?
Are there any fundamental problems to expect if the session-factory is rebuild at runtime? Is there a way to to terminate/invalidate all sessions that where acquired through this sessionFactory?
Has anyone already tried this approach?
thx for any help
stf
|
|