3 Replies Latest reply on Sep 11, 2005 12:22 PM by Norman Richards

    Referencing common classes from a HAR

    Dudley Newbie

      Hi,

      I have 2 HAR files. Har file 1 has all the hibernate classes, while har 2 has only a couple new classes. How does one reference hibernate classes in HAR1 without having to have them in HAR2 explicitly?

        • 1. Re: Referencing common classes from a HAR
          Norman Richards Master

          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)

          • 2. Re: Referencing common classes from a HAR
            Scott Balmos Newbie

            Hi Norman,

            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!

            --Scott

            • 3. Re: Referencing common classes from a HAR
              Norman Richards Master

              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:

              http://docs.jboss.org/nightly/jbossas/adminguide/en/html/ch13.html