]
Stefan Schulze commented on HHH-7300:
-------------------------------------
I created an pull-request for this issue
(<
TypeDefs won't be found depending of files read-order
-----------------------------------------------------
Key: HHH-7300
URL:
https://hibernate.onjira.com/browse/HHH-7300
Project: Hibernate ORM
Issue Type: Bug
Components: metamodel
Affects Versions: 4.0.1, 3.6.10, 4.1.3
Reporter: Stefan Schulze
Labels: configuration, typedef
Attachments: HHH7300-Test.zip
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.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: