Hibernate version: 3.2
Full stack trace of any exception that occurs:
7:30:24,897 INFO SettingsFactory:290 - Deleted entity synthetic identifier rollback: disabled
17:30:24,897 INFO SettingsFactory:305 - Default entity-mode: pojo
17:30:24,897 INFO SettingsFactory:309 - Named query checking : enabled
Exception in thread "main" com.fujitsu.efi.exceptions.InfrastructureException: org.hibernate.QueryException: Unable to resolve path [efiUserByUsrCreateUserId.usrLogin], unexpected token [efiUserByUsrCreateUserId] [from com.fujitsu.efi.infringement.model.EfiInfringement where efiUserByUsrCreateUserId.usrLogin = :login]
at com.fujitsu.efi.infringement.model.dao.EfiInfringementDAO.getEfiInfringementListByUserLogin(EfiInfringementDAO.java:62)
at com.fujitsu.efi.infringement.model.dao.EfiInfringementDAO.testEfiInfringementListByUserLogin(EfiInfringementDAO.java:74)
at com.fujitsu.efi.infringement.model.dao.EfiInfringementDAO.main(EfiInfringementDAO.java:70)
Caused by: org.hibernate.QueryException: Unable to resolve path [efiUserByUsrCreateUserId.usrLogin], unexpected token [efiUserByUsrCreateUserId] [from com.fujitsu.efi.infringement.model.EfiInfringement where efiUserByUsrCreateUserId.usrLogin = :login]
at org.hibernate.hql.ast.tree.IdentNode.resolveAsNakedComponentPropertyRefLHS(IdentNode.java:196)
at org.hibernate.hql.ast.tree.IdentNode.resolve(IdentNode.java:85)
at org.hibernate.hql.ast.tree.DotNode.resolveFirstChild(DotNode.java:143)
at org.hibernate.hql.ast.HqlSqlWalker.lookupProperty(HqlSqlWalker.java:460)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.addrExpr(HqlSqlBaseWalker.java:4326)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1212)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4041)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3525)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1762)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at com.fujitsu.efi.infringement.model.dao.EfiInfringementDAO.getEfiInfringementListByUserLogin(EfiInfringementDAO.java:58)
... 2 more
Name and version of the database you are using:
SQL Server
Can you please check the following code for me?:
If the following code works
Code:
public static List<EfiBatch> getSignedEfiBatchList(){
List<EfiBatch> efiBatchList = null;
try {
Query q = HibernateUtil.currentSession().createQuery(
"from EfiBatch where efiBatchStatus.basStatusCode = :efiBatchStatus");
q.setString("efiBatchStatus", "S");
efiBatchList = q.list();
} catch (HibernateException ex) {
throw new InfrastructureException(ex);
}
return efiBatchList;
}
Hibernate mapping:
Code:
<many-to-one name="efiBatchStatus" class="com.fujitsu.efi.infringement.model.EfiBatchStatus" fetch="select">
<column name="bch_status_id" not-null="true" />
</many-to-one>
But why the following code is not working:
Code:
public static List<EfiInfringement> getEfiInfringementListByUserLogin(){
List<EfiInfringement> efiInfringementList = null;
try {
Query q = HibernateUtil.currentSession().createQuery("from EfiInfringement where efiUserByUsrCreateUserId.usrLogin = :login");
q.setString("login", "admin");
efiInfringementList = q.list();
} catch (HibernateException ex) {
throw new InfrastructureException(ex);
}
return efiInfringementList;
}
Hibernate mapping:
Code:
<many-to-one name="efiUserByInfCreateUserId" class="com.fujitsu.efi.infringement.model.EfiUser" fetch="select">
<column name="inf_create_user_id" not-null="true" />
</many-to-one>