javax.persistence.PersistenceException: org.hibernate.MappingException: Could not determine type for: test.Language, for columns: [org.hibernate.mapping.Formula( langid )]

Hibernate JIRA | Panagiotis Korros | 1 decade ago
  1. 0

    The test case bellow used to run correclty with hibernate beta3 entitymanager beta3 and annotations beta5. After upgrading I get the following exception: javax.persistence.PersistenceException: org.hibernate.MappingException: Could not determine type for: test.Language, for columns: [org.hibernate.mapping.Formula( langid )] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:149) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:73) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27) at test.MapCollectionTestCase.testMapCollection(MapCollectionTestCase.java:12) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: org.hibernate.MappingException: Could not determine type for: test.Language, for columns: [org.hibernate.mapping.Formula( langid )] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253) at org.hibernate.mapping.IndexedCollection.validate(IndexedCollection.java:68) at org.hibernate.cfg.Configuration.validate(Configuration.java:979) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1139) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:358) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:484) at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:96) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:142) ... 19 more

    Hibernate JIRA | 1 decade ago | Panagiotis Korros
    javax.persistence.PersistenceException: org.hibernate.MappingException: Could not determine type for: test.Language, for columns: [org.hibernate.mapping.Formula( langid )]
  2. 0

    The test case bellow used to run correclty with hibernate beta3 entitymanager beta3 and annotations beta5. After upgrading I get the following exception: javax.persistence.PersistenceException: org.hibernate.MappingException: Could not determine type for: test.Language, for columns: [org.hibernate.mapping.Formula( langid )] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:149) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:73) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27) at test.MapCollectionTestCase.testMapCollection(MapCollectionTestCase.java:12) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: org.hibernate.MappingException: Could not determine type for: test.Language, for columns: [org.hibernate.mapping.Formula( langid )] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253) at org.hibernate.mapping.IndexedCollection.validate(IndexedCollection.java:68) at org.hibernate.cfg.Configuration.validate(Configuration.java:979) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1139) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:358) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:484) at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:96) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:142) ... 19 more

    Hibernate JIRA | 1 decade ago | Panagiotis Korros
    javax.persistence.PersistenceException: org.hibernate.MappingException: Could not determine type for: test.Language, for columns: [org.hibernate.mapping.Formula( langid )]
  3. 0

    Does Hibernate disallow read-only on @Column in embedded ID composite primary key classes (bug?)?

    Stack Overflow | 6 years ago | Kawu
    javax.persistence.PersistenceException: [PersistenceUnit: zips] Unable to build EntityManagerFactory
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Repeated column in mapping for entity: Hiv_AnswerForEntities column: variant_id (should be mapped with insert="false" update="false")

    Stack Overflow | 2 years ago
    play.api.UnexpectedException: Unexpected exception[PersistenceException: [PersistenceUnit: defaultPersistenceUnit] Unable to build EntityManagerFactory]
  6. 0

    Currently it is impossible to declare the usage of a CompositeUserType in conjunction with an IdentifierGenerator using JSR220/Hibernate annotations - example: @Id(...) @org.hibernate.annotations.GenericGenerator(...) @org.hibernate.annotations.Type(...) @org.hibernate.annotations.Columns For further reference see attached example. Pure hibernate based version works. Using EntityManager fails with 2005-11-09 15:31:43,431 [DEBUG] [main] [AnnotationConfiguration] Process annotated classes 2005-11-09 15:31:43,435 [DEBUG] [main] [AnnotationConfiguration] processing manytoone fk mappings 2005-11-09 15:31:43,439 [INFO] [main] [Configuration] processing extends queue 2005-11-09 15:31:43,442 [INFO] [main] [Configuration] processing collection mappings 2005-11-09 15:31:43,444 [INFO] [main] [Configuration] processing association property references 2005-11-09 15:31:43,448 [INFO] [main] [Configuration] processing foreign key constraints javax.persistence.PersistenceException: org.hibernate.MappingException: identifier mapping has wrong number of columns: foo.bar.MyObject type: foo.bar.MyCompositeType at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:149) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:73) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27) at foo.bar.SimpleEntityManagerTest.setUp(SimpleEntityManagerTest.java:27) at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31) Caused by: org.hibernate.MappingException: identifier mapping has wrong number of columns: foo.bar.MyObject type: foo.bar.MyCompositeType at org.hibernate.mapping.RootClass.validate(RootClass.java:194) at org.hibernate.cfg.Configuration.validate(Configuration.java:975) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1139) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:358) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:484) at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:96) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:142) ... 17 more ---------------------------- Regarding attached example: Directory pojo contains the entity related files including annotations Directory hibernate contains a junit test using pure hibernate (and HSQL) which does work. Directory jsr220 contains a junit test using EntityManager which fails.

    Hibernate JIRA | 1 decade ago | Jens Schumann
    javax.persistence.PersistenceException: org.hibernate.MappingException: identifier mapping has wrong number of columns: foo.bar.MyObject type: foo.bar.MyCompositeType

  1. esaar 1 times, last 4 months ago
  2. kuldeep 16 times, last 3 months ago
  3. r1chjames 1 times, last 6 months ago
  4. Kawada 6 times, last 6 months ago
  5. Harsh 1 times, last 8 months ago
34 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.MappingException

    Could not determine type for: test.Language, for columns: [org.hibernate.mapping.Formula( langid )]

    at org.hibernate.mapping.SimpleValue.getType()
  2. Hibernate
    Configuration.buildSessionFactory
    1. org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
    2. org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
    3. org.hibernate.mapping.IndexedCollection.validate(IndexedCollection.java:68)
    4. org.hibernate.cfg.Configuration.validate(Configuration.java:979)
    5. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1139)
    5 frames
  3. Hibernate EJB
    HibernatePersistence.createEntityManagerFactory
    1. org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:358)
    2. org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:484)
    3. org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:96)
    4. org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:142)
    5. org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:73)
    5 frames
  4. JavaEE 7
    Persistence.createEntityManagerFactory
    1. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
    2. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
    2 frames
  5. test
    MapCollectionTestCase.testMapCollection
    1. test.MapCollectionTestCase.testMapCollection(MapCollectionTestCase.java:12)
    1 frame
  6. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    4. java.lang.reflect.Method.invoke(Unknown Source)
    4 frames
  7. JUnit
    TestSuite.run
    1. junit.framework.TestCase.runTest(TestCase.java:154)
    2. junit.framework.TestCase.runBare(TestCase.java:127)
    3. junit.framework.TestResult$1.protect(TestResult.java:106)
    4. junit.framework.TestResult.runProtected(TestResult.java:124)
    5. junit.framework.TestResult.run(TestResult.java:109)
    6. junit.framework.TestCase.run(TestCase.java:118)
    7. junit.framework.TestSuite.runTest(TestSuite.java:208)
    8. junit.framework.TestSuite.run(TestSuite.java:203)
    8 frames
  8. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    3 frames