I've a little problem using hibernate queries with the api criteria.
For a class like
public class Document{
private User owner;
private String title;
..........
}
with the classe User
public class User {
private String name;
......
}
with criteria queries i wondered if I can do something like this :
Criteria criteria = session.createCriteria(Document.class);
criteria.add(Expression.eq("owner.name", "fred"));
criteria.list();
when I try do this i've a null pointer excetion, can someon help me please?
java.lang.NullPointerException
net.sf.hibernate.persister.NormalizedEntityPersister.toColumns(NormalizedEntity Persister.java:1099)
net.sf.hibernate.expression.AbstractCriterion.getColumns(AbstractCriterion.java :35)
net.sf.hibernate.expression.IlikeExpression.toSqlString(IlikeExpression.java:32 )
net.sf.hibernate.expression.LogicalExpression.toSqlString(LogicalExpression.jav a:44)
net.sf.hibernate.expression.LogicalExpression.toSqlString(LogicalExpression.jav a:44)
net.sf.hibernate.expression.LogicalExpression.toSqlString(LogicalExpression.jav a:44)
net.sf.hibernate.expression.LogicalExpression.toSqlString(LogicalExpression.jav a:44)
net.sf.hibernate.expression.LogicalExpression.toSqlString(LogicalExpression.jav a:44)
net.sf.hibernate.expression.LogicalExpression.toSqlString(LogicalExpression.jav a:44)
net.sf.hibernate.loader.CriteriaLoader.<init>(CriteriaLoader.java:64)
net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3595)
net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
with the attribut owner in public access I've got the same issue.
Maybe I forgot somthing in my configuration
|