6 Replies Latest reply on Jan 6, 2012 5:17 AM by guinotphil

    AS7-2460 allow hibernate.id.new_generator_mappings=false to be specified in the persistence.xml does not work (for me)

    guinotphil

      Hello,

       

       

      I am currently having an issue with overiding hibernate.id.new_generator_mappings to false.

       

       

      I actually have an EAR project using Hibernate 3.6.9.Final composed of

      * a couple of WAR modules

      * some EJB modules

      * entity beans they all share, which are deployed in a jar into /lib/entities.jar which also contains META-INF/persistence.xml.

       

      In META-INF/persistence.xml, I added:

       

      <property name="hibernate.id.new_generator_mappings" value="false" />

       

       

      But, when I check the properties of the EntityManagerFactory, it is still set to false. Using Seam 2:

      final EntityManager em = (EntityManager) Component.getInstance("entityManager");

      em.getEntityManagerFactory().getProperties().get("hibernate.id.new_generator_mappings");

       

       

       

      Of course, I actually checked that I use a recent JBoss AS 7 build featuring the AS7-2460 patch. https://issues.jboss.org/browse/AS7-2460

       

       

       

      Here is what actually happens during the deployment:

       

       

      First, I pass into org.jboss.as.jpa.hibernate3. HibernatePersistenceProviderAdaptor. addProviderProperties(), but at that point my property map contains only this :

      {javax.persistence.validation.factory=org.jboss.as.jpa.validator.SerializableValidatorFactory@4b31e246}

       

      None, of the persistence.xml properties have been loaded (is it because it is located into a lib/entities.jar ?)

       

       

      Then, I pass into the org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory() which calls org.hibernate.ejb.Ejb3Configuration.configure()

      Method, here my integration properties map does not contains so much more:

      {javax.persistence.validation.factory=org.jboss.as.jpa.validator.SerializableValidatorFactory@4c7814f,

      hibernate.id.new_generator_mappings=true,

      hibernate.transaction.manager_lookup_class=org.jboss.as.jpa.hibernate3.JBossAppServerJtaPlatform}

      But, as you can see the patch set the new generator mappings property as it was not present in the original map.

      However the PersistenceUnitInfo contains all the properties from the persistence.xml which has been loaded at the point.

       

      Then, at line 597

      ConfigurationHelper.overrideProperties( properties, integration );

      override the persistence.xml properties and set hibernate.id.new_generator_mappings to true as present in the integration properties map.

       


       

      So, where should I declare hibernate.id.new_generator_mappings to false? Or is there something wrong with my deployment?

       

       

       

      Thank you very much for your help!