org.hibernate.MappingException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • If the Configuration first load (i.e. addResource or addDirectory or similar) an entity-mapping and after that a type, which is used by the entity, the call to buildSessionFactory() fails: > org.hibernate.MappingException: Could not determine type for: testenumtype, at table: TestTable, for columns: [org.hibernate.mapping.Column(ENUM)] > at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:305) > at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:289) > at org.hibernate.mapping.Property.isValid(Property.java:238) > at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:468) > at org.hibernate.mapping.RootClass.validate(RootClass.java:270) > at org.hibernate.cfg.Configuration.validate(Configuration.java:1294) > at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1736) > at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1782) > at de.ckc.sschulze.hibernate.testcase.MyTest.testFirstEntityThenType(MyTest.java:37) In the secondPassCompile the mappings are processed in the order of addition to the Configuration (in case of addDirectory, addJar and addPackage this is quite random). This can cause the HbmBinder not to find the typedef used in an entity, because the typedef is processed after the entity, so the SimpleValue-type is set to the typename in the entity-mapping instead to the name of the type-class. During validation, the TypeResolver is not able to resolve this typename (because it's no basic type and no classname), so a MappingException is thrown. I think this issue could be solved by registering a new SecondPass in HbmBinder if no typedef could be found and the type is not a basictype, which resolves this unresolved type.
    via by Stefan Schulze,
  • If the Configuration first load (i.e. addResource or addDirectory or similar) an entity-mapping and after that a type, which is used by the entity, the call to buildSessionFactory() fails: > org.hibernate.MappingException: Could not determine type for: testenumtype, at table: TestTable, for columns: [org.hibernate.mapping.Column(ENUM)] > at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:305) > at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:289) > at org.hibernate.mapping.Property.isValid(Property.java:238) > at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:468) > at org.hibernate.mapping.RootClass.validate(RootClass.java:270) > at org.hibernate.cfg.Configuration.validate(Configuration.java:1294) > at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1736) > at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1782) > at de.ckc.sschulze.hibernate.testcase.MyTest.testFirstEntityThenType(MyTest.java:37) In the secondPassCompile the mappings are processed in the order of addition to the Configuration (in case of addDirectory, addJar and addPackage this is quite random). This can cause the HbmBinder not to find the typedef used in an entity, because the typedef is processed after the entity, so the SimpleValue-type is set to the typename in the entity-mapping instead to the name of the type-class. During validation, the TypeResolver is not able to resolve this typename (because it's no basic type and no classname), so a MappingException is thrown. I think this issue could be solved by registering a new SecondPass in HbmBinder if no typedef could be found and the type is not a basictype, which resolves this unresolved type.
    via by Stefan Schulze,
  • Hibernate mapping. Table related with other two
    via Stack Overflow by Rob
    ,
  • To reproduce this issue you need to: a) Load some hbm files using the AnnotationConfiguration b) Use a subclass reference referring to a class in a separate file via the "extends" attribute in your hbm files What happens is that you will get an exception from the buildSessionFactory call on AnnotationConfiguration similar to the following: org.hibernate.MappingException: Following superclasses referenced in extends not found: org.gs1.v202.gdsn.RegistryPartyDataDumpType at org.hibernate.cfg.Configuration.processExtendsQueue(Configuration.java:1077) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1016) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:218) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1138) A simple workaround is to use the base Configuration class rather than the AnnotationConfiguration. However, this is not practical if you need to load a mix of existing hbm files as well as new classes that use annotations. The reason that this occurs is that the AnnotationConfiguration class overrides the add method of Configuration, storing all of the hbm files in a Map for later processing. This works fine for regular class files; however, it is not compatible with the recursive hbm file processing performed by processExtendsQueue. I've attached a fix for this issue that disables the delayed hbm processing before processing of the extends queue begins. This modification fixes this issue in the unit tests of the application I am working on. Please see the attached java file that includes the integrated fix built off the latest CVS version, as well as the unified diff I created via CVS. I would appreciate it if this fix could be rolled into the upcoming 3.1beta7, and would be happy to help out with whatever documentation or unit tests are needed for final integration. Cheers, --Steve
    via by Stephen Chin,
    • org.hibernate.MappingException: Could not determine type for: testenumtype, at table: TestTable, for columns: [org.hibernate.mapping.Column(ENUM)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:305) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:289) at org.hibernate.mapping.Property.isValid(Property.java:238) at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:468) at org.hibernate.mapping.RootClass.validate(RootClass.java:270) at org.hibernate.cfg.Configuration.validate(Configuration.java:1294) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1736) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1782) at de.ckc.sschulze.hibernate.testcase.MyTest.testFirstEntityThenType(MyTest.java:37)

    Users with the same issue

    nasimknasimk
    4 times, last one,
    kuldeepkuldeep
    16 times, last one,
    Unknown visitor
    Unknown visitor2 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    50 more bugmates