2 Replies Latest reply on Jan 31, 2012 3:24 PM by Adam Warski

    Bidirectional associations and hierarchies ( Same problem at different flow)

    Anshu G Newbie

      I am starting this discussion on the new thread as the previos thread seems to be answered and not active.

       

      Please refer to https://community.jboss.org/message/648885 for further details.

       

      ________________________________________

       

      Hello Adam,

       

      I get the similar error ,

       

      Caused by: org.hibernate.MappingException: @AuditMappedBy points to a property that doesn't exist: x.y.EnityClass.auditMappedByProperty

       

      but at a different point.

       

      ClassesAuditingData.forcePropertyInsertable(ClassesAuditingData.java:83)

      ClassesAuditingData.updateCalculatedFields() line: 69

      EntitiesConfigurator.configure(Configuration, ReflectionManager, GlobalConfiguration, AuditEntitiesConfiguration, Document, Element) line: 84

      AuditConfiguration.<init>(Configuration) line: 86

      AuditConfiguration.getFor(Configuration) line: 99

      CustomAuditEventListener(AuditEventListener).initialize(Configuration) line: 335

      EventListeners$1.processListener(Object) line: 198

      EventListeners.processListeners(EventListeners$ListenerProcesser) line: 181

      EventListeners.initializeListeners(Configuration) line: 194

      AnnotationConfiguration(Configuration).getInitializedEventListeners() line: 1396

      AnnotationConfiguration(Configuration).buildSessionFactory() line: 1385

      AnnotationConfiguration.buildSessionFactory() line: 954

      Ejb3Configuration.buildEntityManagerFactory() line: 892

      HibernatePersistence.createContainerEntityManagerFactory(PersistenceUnitInfo, Map) line: 74

       

      I am using hibernate 3.5.6.

       

      To me it doesnt explains, how could you, not get this error, but the error which Hernan reported.

      This could only happen, if it was introduced in the later builds of 3.5.2 (where HHH-5191 is fixed), and Hernan still uses 3.5.2 and not the later builds where it is was introduced.

       

      The reason I say this is because, If You see the Call Hierarchy of CollectionMetaDataGenerator.getMappedBy, it would collide on EntitiesConfigurator.configure at line number 100.

      Whereas the error I get occurs much before in EntitiesConfigurator.configure at line number 84.

       

      As a workaround, I could still not use auditmappedby annotation, and could live with the assosiation table.

       

      But, Please help provide a solution.

       

      I have moidifed the ClassesAuditingData, and it works well, with my usecase now. This helps solve the problem as I mentioned. Could this be accepted as a patch in 3.5.6 ?. Please let me know, the feedback on the patch.

       

      Thanks,