[hibernate-dev] classloading issue when trying to add envers to as7

Adam Warski adam at warski.org
Tue Jun 21 02:23:42 EDT 2011


On Jun 20, 2011, at 7:56 PM, Scott Marlow wrote:

>> 
>> and adding envers into org.hibernate module, means there will no org.hibernate.envers module, and a (jpa) app's classloader can access org.hibernate module, right? so it can access envers class too.
> 
> Wrong, just adding envers to org.hibernate (either via a module dependency or the jar directly) doesn't result in envers being exported from the org.hibernate module.  There is an option to do that, if so desired (via the export="true").  The better option is knowing whether or not it is needed and dynamically injecting envers only if it is.

Not sure how it works exactly, but I suppose that if the application declares somehow that it uses Envers, only then the Envers module should be visible? Looking at the dependencies tree between Hibernate modules, Envers is a leaf, so in theory it should be doable ;).

> From what you previously said, I think the dependencies are:
> 
> - Application classes may reference the envers annotation.
> 
> - Application classes may reference Hibernate classes.
> 
> - Hibernate core may reference envers.
> 
> - Hibernate envers may reference Hibernate core.
> 
> Sound right so far?

Well Core doesn't reference Envers in any way.

Envers aside, I think the Integrators should work anyway. Say a user creates his own Integrator and puts it as part of the application classes - will Hibernate see it on startup? The same applies to Envers - Hibernate should see the integrator if the module is enabled.

-- 
Adam Warski

http://twitter.com/#!/adamwarski
http://www.warski.org
http://www.softwaremill.eu










More information about the hibernate-dev mailing list