休止状態で更新クエリを書くとき。このエラーが発生しています。MySQL 5.0 で Hibernate 3.2 を使用しています。ここで UserDetails.java では、Login は Login.java の主キー (loginId) を参照する外部キーです。
java.lang.NullPointerException
at org.hibernate.hql.ast.util.SessionFactoryHelper.findSQLFunction(SessionFactoryHelper.java:342)
at org.hibernate.hql.ast.tree.IdentNode.getDataType(IdentNode.java:266)
at org.hibernate.hql.ast.tree.BinaryLogicOperatorNode.extractDataType(BinaryLogicOperatorNode.java:168)
at org.hibernate.hql.ast.tree.BinaryLogicOperatorNode.initialize(BinaryLogicOperatorNode.java:34)
at org.hibernate.hql.ast.HqlSqlWalker.prepareLogicOperator(HqlSqlWalker.java:1007)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3992)
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.updateStatement(HqlSqlBaseWalker.java:358)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:237)
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)
ここにサービスクラスがあります
Date birthDay = formatter1.parse(brthDay);
session = HibernateUtil.getSession();
transaction = session.beginTransaction();
Login login = (Login) session.get(Login.class, loginId);
Query query2 = session.createQuery("update UserDetails set name=:Name, secEmailId=:SecEmailId, dob=:DOB, gender=:Gender where Login=:LoginId");
query2.setString("Name", name);
query2.setString("SecEmailId", secEmailId);
query2.setDate("DOB", birthDay);
query2.setString("Gender", gender);
query2.setParameter("LoginId", login);
profileUpdated = query2.executeUpdate();
ここに UserDetails.java pojo クラスがあります
private Long udid;
private Login login;
private String name;
private String secEmailId;
private Date dob;
private String gender;
private long createrId;
private Date createdDate;
private long updaterId;
private Date updatedDate;
settes & getters