3 Replies Latest reply on Dec 1, 2009 2:34 AM by Adam Warski

    1.2.2 snapshot: NPE while processing configuration of the cl

    Andriy Gryn Newbie


      After switching from 1.2.1 GA to the latest 1.2.2 snapshot (25.11.2009) I get NPE if a mapping with composite-id is present in configuration. The classes with composite-id are not audited. It seems that in 1.2.1 this coding was executed only for audited classes. In 1.2.2 all mapped classes go through it. At least in my case for all 3 classes with composite-id that I have PersistentClass.getIdentifierProperty() returns null which causes NPE in IdMetadataGenerator.addId.

      Call stack:

      Exception in thread "main" java.lang.NullPointerException
      at org.hibernate.envers.configuration.metadata.IdMetadataGenerator.addId(IdMetadataGenerator.java:96)
      at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateFirstPass(AuditMetadataGenerator.java:351)
      at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:91)
      at org.hibernate.envers.configuration.AuditConfiguration.(AuditConfiguration.java:86)
      at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99)
      at com.softgenic.database.HibernateHelper.initialise(HibernateHelper.java:111)
      at com.softgenic.database.HibernateHelper.initialise(HibernateHelper.java:36)
      at com.softgenic.launch.SchemaGenerate.main(SchemaGenerate.java:14)

        • 1. Re: 1.2.2 snapshot: NPE while processing configuration of th
          Adam Warski Master


          yes, that's right, all classes have the id-mapper generated, because of the new possibility to audit relations to non-audited entities.

          Could you post your mapping, so that I could reproduce the problem? Composite IDs should normally work fine, so you must have something special :)


          • 2. Re: 1.2.2 snapshot: NPE while processing configuration of th
            Andriy Gryn Newbie

            Hello, Adam,

            Below are composite-id mappings for all 3 classes. At least the last one is very simple. Maybe it has to do with the way I build configuration? Probably calling buildMappings is not enough and hibernate doesn't initialize internal meta-data for composite ids?

            configuration = new AnnotationConfiguration();
             // add resource files
             for (String resource : allMappingResources) {
             for(Class<? extends Object> item : allAnnotatedClasses){
             // in order to configure envers tables main configuration has to be built before
             // configure envers

            Class 1:
            <composite-id unsaved-value="any">
             <key-many-to-one name="accountGroup" access="field"
             <column name="group_uuid" not-null="true" sql-type="char(32)"/>
             <key-property name="number" access="field" type="integer" column="`number`"/>

            Class 2

            <composite-id unsaved-value="any">
             <key-many-to-one name="partner" access="field" class="com.loanworkbench.data.partner.Partner">
             <column name="partner_uuid" not-null="true" sql-type="char(32)"/>
             <key-many-to-one name="branch" access="field" class="com.softgenic.data.Branch" foreign-key="pbranch_fk">
             <column name="branch_uuid" sql-type="char(32)" not-null="true"/>

            Class 3:

             <key-property name="objectNumberId" access="field" column="object_num" length="10"/>
             <key-property name="structureId" access="field" column="structure" length="6"/>
             <key-property name="sectionId" access="field" column="section" length="6"/>
             <key-property name="parameterValue" access="field" column="param_value" length="40"/>

            • 3. Re: 1.2.2 snapshot: NPE while processing configuration of th
              Adam Warski Master


              I just deployed a new snapshot with a check for supported id mappings so this should now work.

              Thanks for the beta-testing :)