Unless you have scoped your classloaders, JBoss will make sure that the classes are visible to each other at runtime. You don't have to do anything.
If you are asking about how to have them in the same configuration, 4.0.3 introduces a new hibernate deployment option, ScanForMappingsEnabled. If both HARs are bundled in a larger application, (an EAR file, perhaps) you can set ScanForMappingsEnabled to true to have the hibernate mbean find all the hibernate objects in the whole application. (then you only need one hibernate MBean definition)
I'm curious about this new option in 4.0.3 . So I can define a single Hibernate MBean which handles all HAR files in an EAR. For one thing, say I define that MBean at the EAR level. What would I now put in the HARs' hibernate-service.xml files?
Also, I've got things in separate HARs and separate MBeans because each app module (each WAR/HAR pair in my EAR) has a separate database for its data. Can this still work in the single-MBean setup?
And maybe this is a separate question, but is there any way to tell Hibernate what database to use at the Hibernate MBean level, rather than in the connection pool JDBC connection URL level? Rather than having n pools of connections (n = number of HARs I have), it'd be nice to reduce this to a single pool of connections to the different databases.
Sorry for all the questions. Just trying to investigate things farther. Thanks for any info!
First, in 4.0.3 the hibernate-service.xml become a normal jboss-service.xml file. If scanning is enabled, each of the individual HAR files would not have a hibernate mbean definition. You could still have other MBeans in there, in which case it is really just a SAR file.
The 4.0.3 hibernate integration is documented here: