[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6039?page=c...
]
Scott Basinger commented on HHH-6039:
-------------------------------------
I added 2 lines to HBMBinder to set the declaredIdentifierProperty and the jpaEntityName.
JPA over hbm files now is creating much better metadata.
if ( propertyName != null ) {
....
entity.setDeclaredIdentifierProperty(prop);
entity.setJpaEntityName(entity.getNodeName());
}
jpaEntityName not set when using Hibernate mapping
--------------------------------------------------
Key: HHH-6039
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6039
Project: Hibernate ORM
Issue Type: Bug
Components: metamodel, query-criteria
Affects Versions: 3.6.2
Environment: hibernate-(core, entitymanager...)-3.6.2.Final
hibernate-jpa-2.0-api-1.0.0.Final
MySQL 5.1
Spring 3.0.5.RELEASE
Reporter: JOUFFRE Nelly
Attachments: Qualifier.hbm.xml
I'm trying to run the following query
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Qualifier> cq = cb.createQuery(Qualifier.class);
Root<Qualifier> qualifRoot = cq.from(Qualifier.class);
List<Qualifier> results = entityManager.createQuery(cq).getResultList();
The Qualifier class is mapped using Hibernate hbm.xml mapping (see attachement)
The entityManagerFactory is configured using a Spring class
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
...
</bean>
This Criteria query throws the exception: org.hibernate.hql.ast.QuerySyntaxException:
unexpected token: null near line 1, column 29 [select generatedAlias0 from null as
generatedAlias0]
The FROM clause, which here is null, is built using the EntityType.jpaEntityName property
which value comes from PersistentClass.jpaEntityName property. But this property is never
set when context is loaded to build the Metamodel.
Is this property not set because the mapping is an hibernate mapping and not a JPA one ?
or is it a bug ?
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira