0

reload hibernate

asked 2010-05-30 13:28:12 +0800

efm gravatar image efm
183 1

Hello,
I'm using ZK and Hibernate.
I want to create a class dynamically (from a template, then compile the class by running javac, then map the class name in hibernate.cfg.xml), but if I don't redeploy/restart the application, that new class will never be loaded. is there anyway to restart hibernate without restarting the application?

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2010-05-30 21:00:00 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

updated 2010-05-30 21:00:44 +0800

Hi efm,
This is NOT related to ZK. In future you might want to post only ZK related queries here. For now here is what I think you can do to solve your problem.
>> I want to create a class dynamically (from a template, then compile the class by running javac, then map the class name in hibernate.cfg.xml)

You can use some jvm instrumentation lib such as javassist to create classes, have them compiled and loaded by the class loader on the fly.

>> is there anyway to restart hibernate without restarting the application

Now to add your dynamically created entities you might wanna take a look at this approach that uses dom4j session to do dynamic mapping. You will have to be careful about the webapp loading and your custom entity/class loading sequence though. Reserach more on the internet for this.

Thanks
- Ashish

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-05-30 13:28:12 +0800

Seen: 303 times

Last updated: May 30 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More