title: Hibernate Criteria Detached query null pointer issue for multiple detached queries
body: <p>I've tried to implement multiple detached queries to get the userId. But it throws null pointer exception.I've tried many solution, but I would not get the proper output.</p>
  
  <pre><code>DetachedCriteria getShortListUser = DetachedCriteria
      .forClass(ShortListedProfileVO.class,"ug")
      .setProjection(Property.forName("ug.candidateId"))
      .add(Restrictions.eq("ug.employerId.parentUserId",employerIdParentId));
  
  DetachedCriteria exampleSubquery = DetachedCriteria
      .forClass(PreferedLocationsVO.class,"pg")
      .setProjection(Property.forName("pg.userId"))   
      .add(Restrictions.in("pg.cityId.id",preferredLocations))
      .add(Property.forName("pg.userId").notIn(getShortListUser));
  </code></pre>
  
  <p>Here with I've attached the Exception</p>
  
  <p>java.lang.NullPointerException
      at org.hibernate.criterion.SubqueryExpression.getTypedValues(SubqueryExpression.java:80)
      at org.hibernate.loader.criteria.CriteriaQueryTranslator.getQueryParameters(CriteriaQueryTranslator.java:251)
      at org.hibernate.criterion.SubqueryExpression.toSqlString(SubqueryExpression.java:55)
      at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:334)
      at org.hibernate.loader.criteria.CriteriaJoinWalker.(CriteriaJoinWalker.java:71)
      at org.hibernate.loader.criteria.CriteriaLoader.(CriteriaLoader.java:68)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1550)
      at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
      at com.loginhire.employer.dao.EmployerSearchEmployeeDAO.SearchEmployee(EmployerSearchEmployeeDAO.java:79)
      at com.loginhire.employer.action.VacancyAction.search(VacancyAction.java:612)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)
      at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:292)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
      at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
      at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)</p>