5 Replies Latest reply on May 31, 2005 2:31 AM by Tom Baeyens

    HARDeployer changes proposal

    Tom Baeyens Master


      I want to propose some changes to the HARDeployer and Hibernate MBean implementation so that those can be used in the context of JBPMDeployer. Basically i want to add support for specifying a hibernate.cfg.xml, replacing the automatic scanning for .hbm.xml files.

      1) The HARDeployer pushes the HarUrl attribute to the Hibernate MBean in the void create(DeploymentInfo) method.

      I want to make this configurable. If a hibernate.cfg.xml is found in the META-INF directory, then a new attribute CfgXmlUrl is pushed to the Hibernate MBean. If the hibernate.cfg.xml is absent, everything remaines as it was namely the HarUrl is pushed to the Hibernate MBean.

      2) The Hibernate MBean should get another attribute: CfgXmlUrl. Then the buildSessionFactory() method of Hibernate should be updated. If the CfgXmlUrl is configured, the sessionfactory will be configured from a hibernate.cfg.xml, otherwise everything remains as it was (the automatic scanning for hibernate mapping files in the .har).

      something like this (bold marks the changes):

       if (cfgXmlUrl!=null) {
       } else {
       cfg.addProperties( getProperties() );
       final File file = new File(harUrl.getFile());
       if ( file.isDirectory() )
       cfg.addDirectory( file );
       cfg.addJar( file );

        • 1. Re: HARDeployer changes proposal
          Steve Ebersole Apprentice

          So if you are not using the "auto-detection" fecture, why exactly even use the HARDeployer?

          • 2. Re: HARDeployer changes proposal
            Steve Ebersole Apprentice

            The reason I ask that is because, aside from the aut-detection, all the other stuff there can be done directly through Hibernate itself.

            • 3. Re: HARDeployer changes proposal
              Tom Baeyens Master

              jBPM's persistence is done with a wrapper around a hibernate Session and SessionFactory. (the wrapped session contains the hibernate queries and things like that)

              the jBPM counterparts are called JbpmSessionFactory and JbpmSession. So i want to create a JBPMDeployer that puts the hibernate SessionFactory *and* the JbpmSessionFactory in JNDI.

              I wanted to reuse the HARDeployer as a base class of the JBPMDeployer to reuse (and not duplicate) the managed properties.

              regards, tom.

              • 4. Re: HARDeployer changes proposal
                Steve Ebersole Apprentice

                So then I'd suggest using the standard MBean that comes with Hibernate itself. That's a standard, vanilla MBean that will run in any JMX server.

                Another option is to wait for something I have been concieving of for the integration code. It's basically the ability to define "satellite" deployments to a HAR deployment. Think of the satellites as extra bundles of mappings/classes to be incorporated into the built session factory; essentially they let you define modules for the session factory that can be dropped into the deploy directory by themselves, without the need to rebundle the main deployment unit. The session factory is rebuilt as additional modules are added (deployed) or removed (un-deployed).

                Either way, I am against modifying the HARDeployer or Hibernate MBean in the manner you suggest. Depending on you exact need, one of the above suggestions is a better route to take.

                • 5. Re: HARDeployer changes proposal
                  Tom Baeyens Master

                  ok. i'll have a look at those options.

                  regards, tom.