javax.persistence.PersistenceException: [PersistenceUnit: GHXPU] Unable to build EntityManagerFactory

Hibernate JIRA | Martin Braure de Calignon | 4 years ago
  1. 0

    While developping, we had some table names generated by the naming strategy more than 64 chars. However, PostGRESQL truncate by default everything over the 63rd character. During the validation process of Hibernate (we have turned on <entry key="hibernate.hbm2ddl.auto" value="validate" /> in our spring configuration), the hibernate failed to validate because it's trying to match the long name (more than > 64chars) with the trunacted one. Here is an example of the stacktrace we have at the start of our application javax.persistence.PersistenceException: [PersistenceUnit: GHXPU] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915) ~[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890) ~[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) ~[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:268) ~[spring-orm-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310) ~[spring-orm-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE] ... 39 common frames omitted Caused by: org.hibernate.HibernateException: Missing table: surgery_case_catalog_and_pricing_completion_after_item_list_assignation at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1272) ~[hibernate-core-4.1.4.Final.jar:4.1.4.Final] at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155) ~[hibernate-core-4.1.4.Final.jar:4.1.4.Final] at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:500) ~[hibernate-core-4.1.4.Final.jar:4.1.4.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1744) ~[hibernate-core-4.1.4.Final.jar:4.1.4.Final] at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94) ~[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905) ~[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final] ... 45 common frames omitted It seems something is wrong with the Dialect, the DatabaseMetadata or the Configuration.validateSchema method. As if there was a miss in using DatabaseMetadata.maxTableNameLength or something like that.

    Hibernate JIRA | 4 years ago | Martin Braure de Calignon
    javax.persistence.PersistenceException: [PersistenceUnit: GHXPU] Unable to build EntityManagerFactory
  2. 0

    While developping, we had some table names generated by the naming strategy more than 64 chars. However, PostGRESQL truncate by default everything over the 63rd character. During the validation process of Hibernate (we have turned on <entry key="hibernate.hbm2ddl.auto" value="validate" /> in our spring configuration), the hibernate failed to validate because it's trying to match the long name (more than > 64chars) with the trunacted one. Here is an example of the stacktrace we have at the start of our application javax.persistence.PersistenceException: [PersistenceUnit: GHXPU] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915) ~[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890) ~[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) ~[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:268) ~[spring-orm-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310) ~[spring-orm-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE] ... 39 common frames omitted Caused by: org.hibernate.HibernateException: Missing table: surgery_case_catalog_and_pricing_completion_after_item_list_assignation at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1272) ~[hibernate-core-4.1.4.Final.jar:4.1.4.Final] at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155) ~[hibernate-core-4.1.4.Final.jar:4.1.4.Final] at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:500) ~[hibernate-core-4.1.4.Final.jar:4.1.4.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1744) ~[hibernate-core-4.1.4.Final.jar:4.1.4.Final] at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94) ~[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905) ~[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final] ... 45 common frames omitted It seems something is wrong with the Dialect, the DatabaseMetadata or the Configuration.validateSchema method. As if there was a miss in using DatabaseMetadata.maxTableNameLength or something like that.

    Hibernate JIRA | 4 years ago | Martin Braure de Calignon
    javax.persistence.PersistenceException: [PersistenceUnit: GHXPU] Unable to build EntityManagerFactory
  3. 0

    Can't set up simple JPA

    Stack Overflow | 3 years ago | Amin
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [app-context.xml]: Cannot resolve reference to bean 'emf' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'emf' defined in class path resource [app-context.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build EntityManagerFactory
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Persistence transaction-type value?

    Stack Overflow | 5 years ago | pierre tautou
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PersonDao': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [file:/opt/apache-tomcat-7.0.16/webapps/webFrontend-1.0-SNAPSHOT/WEB-INF/classes/META-INF/spring/applicationContext-persistence.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: basicPersistenceUnit] Unable to build EntityManagerFactory
  6. 0

    How to solve these exceptions when running in tomcat? - Broadleaf Commerce Discussion Forums

    broadleafcommerce.org | 1 year ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in resource loaded from byte array: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: blPU] Unable to build EntityManagerFactory

  1. davidvanlaatum 5 times, last 1 month ago
  2. Tahir 4 times, last 2 months ago
  3. Kawada 22 times, last 7 months ago
11 unregistered visitors
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.HibernateException

    Missing table: surgery_case_catalog_and_pricing_completion_after_item_list_assignation

    at org.hibernate.cfg.Configuration.validateSchema()
  2. Hibernate
    Configuration.buildSessionFactory
    1. org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1272)[hibernate-core-4.1.4.Final.jar:4.1.4.Final]
    2. org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)[hibernate-core-4.1.4.Final.jar:4.1.4.Final]
    3. org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:500)[hibernate-core-4.1.4.Final.jar:4.1.4.Final]
    4. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1744)[hibernate-core-4.1.4.Final.jar:4.1.4.Final]
    4 frames
  3. Hibernate EJB
    HibernatePersistence.createContainerEntityManagerFactory
    1. org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final]
    2. org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final]
    3. org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final]
    4. org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final]
    5. org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)[hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final]
    5 frames
  4. Spring ORM
    AbstractEntityManagerFactoryBean.afterPropertiesSet
    1. org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:268)[spring-orm-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    2. org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)[spring-orm-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    2 frames
  5. Spring Beans
    AbstractAutowireCapableBeanFactory.initializeBean
    1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    2 frames