[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6039) jpaEntityName not set when using Hibernate mapping

Scott Basinger (JIRA) noreply at atlassian.com
Thu Jan 26 12:51:10 EST 2012


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45265#comment-45265 ] 

Scott Basinger commented on HHH-6039:
-------------------------------------

After a little more testing, the setting of jpaEntityName should be done in bindRootClass, handleSubclass, handleJoinedSubclass and handleUnionSubclass by adding a line similar to this:

subclass.setJpaEntityName(subclass.getNodeName());

Then the bindSimpleID and bindCompositeId methods would have the line: 

			entity.setDeclaredIdentifierProperty(prop);

Then we get rid of our UnknownProperty and generatedAlias null issues. (So far).

> 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
>            Assignee: Gail Badner
>         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

        


More information about the hibernate-issues mailing list