I understand the need for PUInfo.getNewTempClassLoader() as
getResource("META-INF/persistence.xml") may/will return multiples.
Also, you may want to introspect the class for annotations before you
decide what needs to be bytecode massaged.
As for getClassLoader()? I'm not sure of the reasoning. I know Scott
has some spec input on this. Maybe we should get it removed?
Emmanuel Bernard wrote:
Year I'm aware of that Bill :-)
But in this case, and like Max said, why on earth the
PersistenceUnitInfo has a getClassLoader() method instead of using the
context CL?
Bill Burke wrote:
Max Rydahl Andersen wrote:
If it is for the spec then I would argue that the spec is very wrong
since it will
break all other kind of stuff. Like how will you convince all the
external libraries hibernate
uses to use your "magic" classloader ? (e.g. log4j, dom4j, cglib,
yada, yada)
Thread.getContextCL() is the only way. If a library doesn't use
Thread.getCCL() then it is a poorly written library. App server and
J2EE in general require this because of classloader isolation (scoped
ears or wars). If you are within Hibernate code and call
Class.forName() it will use the classloader that loaded Hibernate to
load the class. (read the javadocs) and you could get CCE, CNF
exceptions. If you already know this, then apologies.
The same issues effect the loading of resources.
Bill
--
Bill Burke
Chief Architect
JBoss Inc.
-------------------------------------------------------
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