1 Reply Latest reply on Oct 1, 2005 12:36 PM by duranek

    Using Hibernate in multiple applications

    tesuji

      I'm trying to use Hibernate in several applications, each of which has their own EJB. So far the only way I know how to 'deploy' hibernated classes is by making a .SAR archive with the corresponding hbm.xml files and class-files and the (not very aptly named) jboss-service.xml that describes the HibernateFactory MBean.

      Each works fine on its own. I'm developing more than one application however, and they run on the same JBoss server. For each application I have an .EAR and a .SAR (being able to put everything in the .EAR would have been much more convenient.) When I deploy all of it I get an error when it gets to the second .SAR file complaining:

      org.jboss.deployment.DeploymentException: Trying to install an already
      registered mbean: jboss.jca:service=HibernateFactory, name=HibernateFactory)

      Does it mean I can have only one .SAR with Hibernate data in it? Or is there a way to deploy the mapping data separately? If not that would be extremely inconvenient, as I don't like to create dependencies between otherwise completely unrelated applications and their EJBs.

      I did find references to a har-deployer using .HAR files. With these it seems possible to provide mapping data on a per .EAR basis. This is related to version 3.2.6 however, which I can't find anywhere.