|
Hi,
Some times hibernaet return null for select query, although table contain data.
May I know why it is happening, I tried a lot but couldn't get any solution for it. My code is as follows
String query = "select usr from User usr where usr.email3= :email and AGENT=:agt"; String[] parmaNames = new String[2]; Object[] parmaValues = new Object[2]; parmaNames[0] = "email"; parmaValues[0] = email.toLowerCase(); parmaNames[1] = "agt"; parmaValues[1] = "I"; List uList = getHibernateTemplate().findByNamedParam(query, parmaNames, parmaValues); if(uList == null || uList.size()==0 ){ if(email != null){ logger.info("Case for email as loginid email_id :"+email+" and its length is :"+email.length()); } return null; }else return (User)uList.get(0);
Thanks in advance
|