1 Reply Latest reply on Dec 15, 2005 12:33 PM by cracru

    JBoss + Hibernate + Annotations -> How?

    cracru

      If I want to use annotations in Hibernate, and still use JBoss' Hibernate mbean for the session factory, how do I configure the factory to know about the annotated classes?

      In the Hibernate docs, this is done via modifications to the session in HibernateUtil before the session is built, or via mapping sub-elements on the session-factory element in hibernate-configuration.

      How do I achieve this via mbean configuration? I am ignoring the EJB3 route (EJB3/PAR files) for now.

      Thanks, cc

        • 1. Re: JBoss + Hibernate + Annotations -> How?
          cracru

          I've looked at both JBoss and Hibernate source, and I am thinking the quick answer is NO. At least in JBoss 4.0.3.

          Currently, the JBoss Hibernate MBean uses a Configuration object to initialize the session factory. In order to support annotations, it will need to use an AnnotationConfiguration object for initialization. It will also need to add some facility through the MBean's attributes to add the annotated packages and classes.

          So, for those using JBoss 4.0.3, wishing to try out annotations without resorting to EJB3, it looks like JBoss' Hibernate session mgmt cannot be used.