title: How to write update query in Hibernate for where clause i am using foreign key column?
body: <p>when i write update query in hibernate. i am getting this error. I am using Hibernate 3.2 with MySQL 5.0.Here in UserDetails.java, Login is forign key referencing to primary key (loginId) of Login.java .</p>
  
  <pre><code>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.&lt;init&gt;(HQLQueryPlan.java:77)
      at org.hibernate.engine.query.HQLQueryPlan.&lt;init&gt;(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)
  </code></pre>
  
  <p>Here  is Service class</p>
  
  <pre><code> 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();
  </code></pre>
  
  <p>Here is UserDetails.java pojo class</p>
  
  <pre><code>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 &amp; getters
  </code></pre>