Enver throws Nullpointer exception with a self reference entities
-----------------------------------------------------------------
Key: HHH-3923
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3923
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.3.1
Environment: Hibernate Version: 3.3.1.GA
Database: Mysql 5.0
Reporter: Tahseen Ur Rehman
Priority: Blocker
@Entity(name = "category")
@Audited
public class Category {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private String name;
@ManyToOne
private Category parent;
@OneToMany(mappedBy = "parent")
private List<Category> childerns = new ArrayList<Category>();
....
}
Exception:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.carbonetworks.footprint.Footprint.initHibernate(Footprint.java:125)
at com.carbonetworks.footprint.Footprint.init(Footprint.java:73)
at com.carbonetworks.footprint.Main.main(Main.java:36)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: footprint] Unable to
build EntityManagerFactory
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
at com.carbonetworks.footprint.Footprint.initHibernate(Footprint.java:109)
... 2 more
Caused by: org.hibernate.HibernateException: could not init listeners
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:205)
at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1338)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
... 6 more
Caused by: java.lang.NullPointerException
at
org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addOneToManyAttached(CollectionMetadataGenerator.java:164)
at
org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addCollection(CollectionMetadataGenerator.java:150)
at
org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addValue(AuditMetadataGenerator.java:141)
at
org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addProperties(AuditMetadataGenerator.java:161)
at
org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateSecondPass(AuditMetadataGenerator.java:385)
at
org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:96)
at
org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:86)
at
org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99)
at org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:249)
at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
... 10 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira