Hi guys,
For EJB3 and app server integration, I need to inject a specific classloader that may load all classes and resources needed by Hibernate.

There are 2 distinct needs for a classloader in Hibernate
Configuration time (ie until the SF is built)
Runtime (session time use)

For Configuration time, I can see 2 solutions:
1. Overriding the Thread.currentThread().setContextClassLoader() and restore the previous one when the SF is built. 2. hacking all the APIs and keep track of the classloader instance round every ReflectHelper, SerializationHelper and so on
 3. keep track of the classloader in a ThreadLocal variable

I like 1. but it requires some security relax from an app server POV (server.policy)
2. I think 2 is not an option
3. seems fine, but might lead to memory leaks and other weird stuffs and it requires to change ReflectHelper a bit.

For Runtime:
1. expect the app server to set the appropriate classloader in the current thread, which probably makes sense since the application itself could use the same classloader and expect the same classes to be retrieved. And unless I'm wrong, I think during runtime (after sf creation), we only reload already loaded classes at configuration time. 2. keep track of the classloader on a per SF basis and call this static variable for every ReflectHelper (etc) call

I don't like 2.

Any opinion on that? A second pair of eyes is welcome.

BTW sometimes, in Hibernate we do not use ReflectHelper, but use some specific way to load classes or resources. Is it intentional?



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to