[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5735?page=c...
]
Florian Oetke updated HHH-5735:
-------------------------------
Attachment: CriteriaTypePredicate.java
I've written a simple workaround for this bug (a attribute, that is used as expression
needs to be joined, first).
Usage Path.type() in expressions throws
java.lang.IllegalArgumentException
---------------------------------------------------------------------------
Key: HHH-5735
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5735
Project: Hibernate Core
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.6.0, 3.6.1
Reporter: Jaroslaw Lewandowski
Fix For: 3.6.5, 4.0.0.Beta1
Attachments: CriteriaTypePredicate.java, InheritanceTest.tgz
It is not possible to filter entities using Path.type() in Criteria Query API. Using
type() in expressions throws an exception:
Unexpected call on EntityTypeExpression#render
java.lang.IllegalArgumentException: Unexpected call on EntityTypeExpression#render
at org.hibernate.ejb.criteria.expression.PathTypeExpression.render( at
org.hibernate.ejb.criteria.expression.PathTypeExpression.render(PathTypeExpression.java:48PathTypeExpression.java:48)
)
at
org.hibernate.ejb.criteria.predicate.ComparisonPredicate.render(ComparisonPredicate.java:173)
at org.hibernate.ejb.criteria.QueryStructure.render(QueryStructure.java:258)
at
org.hibernate.ejb.criteria.CriteriaQueryImpl.render(CriteriaQueryImpl.java:340)
at
org.hibernate.ejb.criteria.CriteriaQueryCompiler.compile(CriteriaQueryCompiler.java:223)
at
org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:441)
at foo.InheritanceTest.critQryTest(InheritanceTest.java:55)
Test case is attached and it's similar to an example from JPA 2.0 specification -
chapter 6.5.7 Example 2:
CriteriaQuery<Employee> q = cb.createQuery(Employee.class);
Root<Employee> emp = q.from(Employee.class);
q.select(emp)
.where(cb.notEqual(emp.type(), Exempt.class));
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira