goashok / hibernate-generic-dao

Automatically exported from code.google.com/p/hibernate-generic-dao
0 stars 0 forks source link

Should use Entity Name in the JPQL in terms of JPA specification #59

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In current implementation, the Full Qualified Class Name is being used in 
Query. For example, the _all() method in JPABaseDAO:

#########################################

protected <T> List<T> _all(Class<T> type) {
    return em().createQuery("select _it_ from " + type.getName() + " 
_it_").getResultList();
}

#########################################

The "type.getName()" will return full qualified class name.
It could work with Hibernate and OpenJPA which extend to support it.

However, the entity name should be used per JPA specification. And 
EclipseLink can only support entity name.

- It could be resolved to use javax.persistence.Metamodel
- Or, use Criterial API introduced in JPA 2.0

Original issue reported on code.google.com by Jirong.Gao on 8 Mar 2010 at 2:32

GoogleCodeExporter commented 9 years ago
You are right. We should get the entity name from the Hibernate or JPA 
metadata. 
Thanks for pointing this out.

Original comment by dwolvert on 12 Mar 2010 at 5:11

GoogleCodeExporter commented 9 years ago
Fixed for 0.5.2

Original comment by dwolvert on 22 Nov 2010 at 3:55

GoogleCodeExporter commented 9 years ago

Original comment by dwolvert on 27 Feb 2011 at 5:32