org.hibernate.MappingException: Could not determine type for column TABLE_COLUMN_ID of type org.hibernate.type.ManyToOneType: org.hibernate.MappingException

Hibernate JIRA | Martin Zdila | 1 decade ago
  1. 0

    Hibernate developers and/or gurus, please look at the following code I found suspicious that in Hibernate is bug. From following code the irrelevant properties and mapping was removed (and like that it was also tested). I've spent a whole day solving this problem with no result. Using "Table per subclass" - Hibernate throws an exception (why?). Using "Table per concrete class" Hibernate runs without problems. Table per subclass: BLOCK 1 is not commented out, BLOCK 2 is commented out Table per concrete class: BLOCK 1 is commented out, BLOCK 2 is not commented out Mapping documents: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.kovine.kfe.dao.TableColumn" table="KFE_TABLE_COLUMN"> <id name="id" unsaved-value="null" column="TABLE_COLUMN_ID"> <generator class="sequence"> <param name="sequence">KFE_TABLE_COLUMN_ID_SEQ</param> </generator> </id> </class> <class name="com.kovine.kfe.dao.Widget" table="KFE_WIDGET"> <id name="id" unsaved-value="null" column="WIDGET_ID"> <generator class="sequence"> <param name="sequence">KFE_WIDGET_ID_SEQ</param> </generator> </id> <!-- BLOCK 1: <joined-subclass name="com.kovine.kfe.dao.WidgetText" table="KFE_WIDGET_TYPE_INPUTTEXT"> <key column="WIDGET_ID" /> <many-to-one unique="true" name="tableColumn" class="com.kovine.kfe.dao.TableColumn" cascade="all" column="TABLE_COLUMN_ID" not-null="true" /> </joined-subclass> --> </class> <!-- BLOCK 2 --> <class name="com.kovine.kfe.dao.WidgetType"> <id name="id" unsaved-value="null" column="WIDGET_TYPE_ID"> <generator class="sequence"> <param name="sequence">KFE_WIDGET_ID_SEQ</param> </generator> </id> <union-subclass name="com.kovine.kfe.dao.WidgetText" table="KFE_WIDGET_TYPE_INPUTTEXT"> <many-to-one unique="true" name="tableColumn" class="com.kovine.kfe.dao.TableColumn" cascade="all" column="TABLE_COLUMN_ID" not-null="true" /> </union-subclass> </class> </hibernate-mapping> Code between sessionFactory.openSession() and session.close(): none. sessionFactory.openSession() causes exception public class WidgetText extends WidgetType { private TableColumn tableColumn; public TableColumn getTableColumn() { return tableColumn; } public void setTableColumn(TableColumn tableColumn) { this.tableColumn = tableColumn; } } public abstract class WidgetType { private Integer id; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } } Full stack trace of any exception that occurs: INFO Configuration - Mapping resource: com/kovine/kfe/dao/TableColumn.hbm.xml INFO HbmBinder - Mapping class: com.kovine.kfe.dao.TableColumn -> KFE_TABLE_COLUMN INFO HbmBinder - Mapping class: com.kovine.kfe.dao.Widget -> KFE_WIDGET INFO HbmBinder - Mapping class: com.kovine.kfe.dao.WidgetType -> WidgetType INFO HbmBinder - Mapping union-subclass: com.kovine.kfe.dao.WidgetText -> KFE_WIDGET_TYPE_INPUTTEXT INFO Configuration - Configured SessionFactory: null INFO Configuration - processing extends queue INFO Configuration - processing collection mappings INFO Configuration - processing association property references INFO Configuration - processing foreign key constraints INFO Dialect - Using dialect: org.hibernate.dialect.Oracle9Dialect INFO SettingsFactory - Default batch fetch size: 1 INFO SettingsFactory - Generate SQL with comments: disabled INFO SettingsFactory - Order SQL updates by primary key: disabled INFO SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory INFO ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory INFO SettingsFactory - Query language substitutions: {} INFO NamingHelper - JNDI InitialContext properties:{} INFO DatasourceConnectionProvider - Using datasource: java:comp/env/jdbc/kfe INFO SettingsFactory - JDBC batch size: 15 INFO SettingsFactory - JDBC batch updates for versioned data: disabled INFO SettingsFactory - Scrollable result sets: enabled INFO SettingsFactory - JDBC3 getGeneratedKeys(): disabled INFO TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions) INFO TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) INFO SettingsFactory - Automatic flush during beforeCompletion(): disabled INFO SettingsFactory - Automatic session close at end of transaction: disabled INFO SettingsFactory - Cache provider: org.hibernate.cache.EhCacheProvider INFO SettingsFactory - Second-level cache: enabled INFO SettingsFactory - Optimize cache for minimal puts: disabled INFO SettingsFactory - Structured second-level cache entries: enabled INFO SettingsFactory - Query cache: disabled INFO SettingsFactory - Statistics: disabled INFO SettingsFactory - Deleted entity synthetic identifier rollback: disabled INFO SettingsFactory - Default entity-mode: pojo INFO SessionFactoryImpl - building session factory ERROR HibernateUtil - Initial SessionFactory creation failed. org.hibernate.MappingException: Could not determine type for column TABLE_COLUMN_ID of type org.hibernate.type.ManyToOneType: org.hibernate.MappingException at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:131) at org.hibernate.persister.entity.UnionSubclassEntityPersister.generateSubquery(UnionSubclassEntityPersister.java:320) at org.hibernate.persister.entity.UnionSubclassEntityPersister.<init>(UnionSubclassEntityPersister.java:135) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:61) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:199) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1043) at com.kovine.kfe.HibernateUtil.<clinit>(HibernateUtil.java:30) ... Caused by: org.hibernate.MappingException: Unknown entity: com.kovine.kfe.dao.TableColumn at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:489) at org.hibernate.impl.SessionFactoryImpl.getIdentifierType(SessionFactoryImpl.java:563) at org.hibernate.type.EntityType.getIdentifierType(EntityType.java:216) at org.hibernate.type.EntityType.getIdentifierOrUniqueKeyType(EntityType.java:226) at org.hibernate.type.ManyToOneType.sqlTypes(ManyToOneType.java:29) at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:124) ... 87 morete.type.ManyToOneType.sqlTypes(ManyToOneType.java:29) at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:124) ... 87 morere

    Hibernate JIRA | 1 decade ago | Martin Zdila
    org.hibernate.MappingException: Could not determine type for column TABLE_COLUMN_ID of type org.hibernate.type.ManyToOneType: org.hibernate.MappingException
  2. 0

    Hibernate developers and/or gurus, please look at the following code I found suspicious that in Hibernate is bug. From following code the irrelevant properties and mapping was removed (and like that it was also tested). I've spent a whole day solving this problem with no result. Using "Table per subclass" - Hibernate throws an exception (why?). Using "Table per concrete class" Hibernate runs without problems. Table per subclass: BLOCK 1 is not commented out, BLOCK 2 is commented out Table per concrete class: BLOCK 1 is commented out, BLOCK 2 is not commented out Mapping documents: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.kovine.kfe.dao.TableColumn" table="KFE_TABLE_COLUMN"> <id name="id" unsaved-value="null" column="TABLE_COLUMN_ID"> <generator class="sequence"> <param name="sequence">KFE_TABLE_COLUMN_ID_SEQ</param> </generator> </id> </class> <class name="com.kovine.kfe.dao.Widget" table="KFE_WIDGET"> <id name="id" unsaved-value="null" column="WIDGET_ID"> <generator class="sequence"> <param name="sequence">KFE_WIDGET_ID_SEQ</param> </generator> </id> <!-- BLOCK 1: <joined-subclass name="com.kovine.kfe.dao.WidgetText" table="KFE_WIDGET_TYPE_INPUTTEXT"> <key column="WIDGET_ID" /> <many-to-one unique="true" name="tableColumn" class="com.kovine.kfe.dao.TableColumn" cascade="all" column="TABLE_COLUMN_ID" not-null="true" /> </joined-subclass> --> </class> <!-- BLOCK 2 --> <class name="com.kovine.kfe.dao.WidgetType"> <id name="id" unsaved-value="null" column="WIDGET_TYPE_ID"> <generator class="sequence"> <param name="sequence">KFE_WIDGET_ID_SEQ</param> </generator> </id> <union-subclass name="com.kovine.kfe.dao.WidgetText" table="KFE_WIDGET_TYPE_INPUTTEXT"> <many-to-one unique="true" name="tableColumn" class="com.kovine.kfe.dao.TableColumn" cascade="all" column="TABLE_COLUMN_ID" not-null="true" /> </union-subclass> </class> </hibernate-mapping> Code between sessionFactory.openSession() and session.close(): none. sessionFactory.openSession() causes exception public class WidgetText extends WidgetType { private TableColumn tableColumn; public TableColumn getTableColumn() { return tableColumn; } public void setTableColumn(TableColumn tableColumn) { this.tableColumn = tableColumn; } } public abstract class WidgetType { private Integer id; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } } Full stack trace of any exception that occurs: INFO Configuration - Mapping resource: com/kovine/kfe/dao/TableColumn.hbm.xml INFO HbmBinder - Mapping class: com.kovine.kfe.dao.TableColumn -> KFE_TABLE_COLUMN INFO HbmBinder - Mapping class: com.kovine.kfe.dao.Widget -> KFE_WIDGET INFO HbmBinder - Mapping class: com.kovine.kfe.dao.WidgetType -> WidgetType INFO HbmBinder - Mapping union-subclass: com.kovine.kfe.dao.WidgetText -> KFE_WIDGET_TYPE_INPUTTEXT INFO Configuration - Configured SessionFactory: null INFO Configuration - processing extends queue INFO Configuration - processing collection mappings INFO Configuration - processing association property references INFO Configuration - processing foreign key constraints INFO Dialect - Using dialect: org.hibernate.dialect.Oracle9Dialect INFO SettingsFactory - Default batch fetch size: 1 INFO SettingsFactory - Generate SQL with comments: disabled INFO SettingsFactory - Order SQL updates by primary key: disabled INFO SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory INFO ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory INFO SettingsFactory - Query language substitutions: {} INFO NamingHelper - JNDI InitialContext properties:{} INFO DatasourceConnectionProvider - Using datasource: java:comp/env/jdbc/kfe INFO SettingsFactory - JDBC batch size: 15 INFO SettingsFactory - JDBC batch updates for versioned data: disabled INFO SettingsFactory - Scrollable result sets: enabled INFO SettingsFactory - JDBC3 getGeneratedKeys(): disabled INFO TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions) INFO TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) INFO SettingsFactory - Automatic flush during beforeCompletion(): disabled INFO SettingsFactory - Automatic session close at end of transaction: disabled INFO SettingsFactory - Cache provider: org.hibernate.cache.EhCacheProvider INFO SettingsFactory - Second-level cache: enabled INFO SettingsFactory - Optimize cache for minimal puts: disabled INFO SettingsFactory - Structured second-level cache entries: enabled INFO SettingsFactory - Query cache: disabled INFO SettingsFactory - Statistics: disabled INFO SettingsFactory - Deleted entity synthetic identifier rollback: disabled INFO SettingsFactory - Default entity-mode: pojo INFO SessionFactoryImpl - building session factory ERROR HibernateUtil - Initial SessionFactory creation failed. org.hibernate.MappingException: Could not determine type for column TABLE_COLUMN_ID of type org.hibernate.type.ManyToOneType: org.hibernate.MappingException at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:131) at org.hibernate.persister.entity.UnionSubclassEntityPersister.generateSubquery(UnionSubclassEntityPersister.java:320) at org.hibernate.persister.entity.UnionSubclassEntityPersister.<init>(UnionSubclassEntityPersister.java:135) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:61) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:199) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1043) at com.kovine.kfe.HibernateUtil.<clinit>(HibernateUtil.java:30) ... Caused by: org.hibernate.MappingException: Unknown entity: com.kovine.kfe.dao.TableColumn at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:489) at org.hibernate.impl.SessionFactoryImpl.getIdentifierType(SessionFactoryImpl.java:563) at org.hibernate.type.EntityType.getIdentifierType(EntityType.java:216) at org.hibernate.type.EntityType.getIdentifierOrUniqueKeyType(EntityType.java:226) at org.hibernate.type.ManyToOneType.sqlTypes(ManyToOneType.java:29) at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:124) ... 87 morete.type.ManyToOneType.sqlTypes(ManyToOneType.java:29) at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:124) ... 87 morere

    Hibernate JIRA | 1 decade ago | Martin Zdila
    org.hibernate.MappingException: Could not determine type for column TABLE_COLUMN_ID of type org.hibernate.type.ManyToOneType: org.hibernate.MappingException
  3. 0

    Eclipse Community Forums: EMF ยป [CDO HibernateStore] Cannot use identity column key generation with <union-subclass> mapping f

    eclipse.org | 5 months ago
    org.hibernate.MappingException: Cannot use identity column key generation with <union-subclass> mapping for: Annotation
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Hi, there is a problem when a class is @Audited and this has an @EmbeddedId (only when the Embeddable class has ManyToOne relationship). Example code: persistence.xml: <?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="TestAuditPU" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.connection.username" value="root"/> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/> <property name="hibernate.connection.password" value=""/> <property name="hibernate.connection.url" value="jdbc:mysql://192.168.0.6:3306/idm"/> <property name="hibernate.ejb.event.post-insert" value="org.hibernate.ejb.event.EJB3PostInsertEventListener,org.hibernate.envers.event.AuditEventListener" /> <property name="hibernate.ejb.event.post-update" value="org.hibernate.ejb.event.EJB3PostUpdateEventListener,org.hibernate.envers.event.AuditEventListener" /> <property name="hibernate.ejb.event.post-delete" value="org.hibernate.ejb.event.EJB3PostDeleteEventListener,org.hibernate.envers.event.AuditEventListener" /> <property name="hibernate.ejb.event.pre-collection-update" value="org.hibernate.envers.event.AuditEventListener" /> <property name="hibernate.ejb.event.pre-collection-remove" value="org.hibernate.envers.event.AuditEventListener" /> <property name="hibernate.ejb.event.post-collection-recreate" value="org.hibernate.envers.event.AuditEventListener" /> </properties> </persistence-unit> </persistence> Class A: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package testaudit; import java.io.Serializable; import javax.persistence.*; import org.hibernate.envers.Audited; /** * * @author heir */ @Entity @Table(name="tblA") @Audited public class A implements Serializable { @Id private String name; @OneToMany(mappedBy="bpk.a") private java.util.List<B> bs; public A() { } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the bs */ public java.util.List<B> getBs() { return bs; } /** * @param bs the bs to set */ public void setBs(java.util.List<B> bs) { this.bs = bs; } } Class B: @Entity @Table(name="tblB") @Audited public class B implements Serializable { @Id private BPK bpk; public B() { } /** * @return the bpk */ public BPK getBpk() { return bpk; } /** * @param bpk the bpk to set */ public void setBpk(BPK bpk) { this.bpk = bpk; } } Class BPK: @Embeddable public class BPK implements Serializable { private String name; @ManyToOne(targetEntity=testaudit.A.class, cascade={CascadeType.ALL}) @JoinColumn(name="strAName") private A a; public BPK() { } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the a */ public A getA() { return a; } /** * @param a the a to set */ public void setA(A a) { this.a = a; } } Exception: Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: TestAuditPU] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:900) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32) at testaudit.Main.main(Main.java:23) 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:1396) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:891) ... 4 more Caused by: org.hibernate.MappingException: Type not supported: org.hibernate.type.ManyToOneType at org.hibernate.envers.configuration.metadata.IdMetadataGenerator.addIdProperties(IdMetadataGenerator.java:75) at org.hibernate.envers.configuration.metadata.IdMetadataGenerator.addId(IdMetadataGenerator.java:120) at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateFirstPass(AuditMetadataGenerator.java:374) at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:100) 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:334) 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) ... 8 more Java Result: 1 Thanks Heinen Rino

    Hibernate JIRA | 6 years ago | Rino Heinen
    javax.persistence.PersistenceException: [PersistenceUnit: TestAuditPU] Unable to build EntityManagerFactory
  6. 0

    Hi, there is a problem when a class is @Audited and this has an @EmbeddedId (only when the Embeddable class has ManyToOne relationship). Example code: persistence.xml: <?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="TestAuditPU" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.connection.username" value="root"/> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/> <property name="hibernate.connection.password" value=""/> <property name="hibernate.connection.url" value="jdbc:mysql://192.168.0.6:3306/idm"/> <property name="hibernate.ejb.event.post-insert" value="org.hibernate.ejb.event.EJB3PostInsertEventListener,org.hibernate.envers.event.AuditEventListener" /> <property name="hibernate.ejb.event.post-update" value="org.hibernate.ejb.event.EJB3PostUpdateEventListener,org.hibernate.envers.event.AuditEventListener" /> <property name="hibernate.ejb.event.post-delete" value="org.hibernate.ejb.event.EJB3PostDeleteEventListener,org.hibernate.envers.event.AuditEventListener" /> <property name="hibernate.ejb.event.pre-collection-update" value="org.hibernate.envers.event.AuditEventListener" /> <property name="hibernate.ejb.event.pre-collection-remove" value="org.hibernate.envers.event.AuditEventListener" /> <property name="hibernate.ejb.event.post-collection-recreate" value="org.hibernate.envers.event.AuditEventListener" /> </properties> </persistence-unit> </persistence> Class A: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package testaudit; import java.io.Serializable; import javax.persistence.*; import org.hibernate.envers.Audited; /** * * @author heir */ @Entity @Table(name="tblA") @Audited public class A implements Serializable { @Id private String name; @OneToMany(mappedBy="bpk.a") private java.util.List<B> bs; public A() { } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the bs */ public java.util.List<B> getBs() { return bs; } /** * @param bs the bs to set */ public void setBs(java.util.List<B> bs) { this.bs = bs; } } Class B: @Entity @Table(name="tblB") @Audited public class B implements Serializable { @Id private BPK bpk; public B() { } /** * @return the bpk */ public BPK getBpk() { return bpk; } /** * @param bpk the bpk to set */ public void setBpk(BPK bpk) { this.bpk = bpk; } } Class BPK: @Embeddable public class BPK implements Serializable { private String name; @ManyToOne(targetEntity=testaudit.A.class, cascade={CascadeType.ALL}) @JoinColumn(name="strAName") private A a; public BPK() { } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the a */ public A getA() { return a; } /** * @param a the a to set */ public void setA(A a) { this.a = a; } } Exception: Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: TestAuditPU] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:900) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32) at testaudit.Main.main(Main.java:23) 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:1396) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:891) ... 4 more Caused by: org.hibernate.MappingException: Type not supported: org.hibernate.type.ManyToOneType at org.hibernate.envers.configuration.metadata.IdMetadataGenerator.addIdProperties(IdMetadataGenerator.java:75) at org.hibernate.envers.configuration.metadata.IdMetadataGenerator.addId(IdMetadataGenerator.java:120) at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateFirstPass(AuditMetadataGenerator.java:374) at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:100) 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:334) 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) ... 8 more Java Result: 1 Thanks Heinen Rino

    Hibernate JIRA | 6 years ago | Rino Heinen
    javax.persistence.PersistenceException: [PersistenceUnit: TestAuditPU] Unable to build EntityManagerFactory

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.MappingException

      Could not determine type for column TABLE_COLUMN_ID of type org.hibernate.type.ManyToOneType: org.hibernate.MappingException

      at org.hibernate.mapping.Column.getSqlTypeCode()
    2. Hibernate
      UnionSubclassEntityPersister.<init>
      1. org.hibernate.mapping.Column.getSqlTypeCode(Column.java:131)
      2. org.hibernate.persister.entity.UnionSubclassEntityPersister.generateSubquery(UnionSubclassEntityPersister.java:320)
      3. org.hibernate.persister.entity.UnionSubclassEntityPersister.<init>(UnionSubclassEntityPersister.java:135)
      3 frames
    3. Hibernate
      SessionFactoryImpl.<init>
      1. org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:61)
      2. org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:199)
      2 frames
    4. Hibernate
      Configuration.buildSessionFactory
      1. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1043)
      1 frame
    5. com.kovine.kfe
      HibernateUtil.<clinit>
      1. com.kovine.kfe.HibernateUtil.<clinit>(HibernateUtil.java:30)
      1 frame