@Repository
public class LoginDao {
@Autowired
private SessionFactory factory;
private Session hbsession;
@Transactional
public UserRegistration findCustomer(String email)
{
System.out.println("in dao");
hbsession = factory.getCurrentSession();
Query qry = hbsession.createQuery("from UserRegistration where EmailId = '"+email+"'");*emphasized text*
List<String> list = qry.list();
System.out.println("list size : "+list.size());
return (UserRegistration) list;
}
}
output : query==>QueryImpl(from UserRegistration where EmailId = 'sonam@gmail.com')
Hibernate: select userregist0_.CUSTOMERID as CUSTOMERID1_0_, userregist0_.ADDRESS as ADDRESS2_0_, userregist0_.NUM_CART as NUM_CART3_0_, userregist0_.STR_EMAILID as STR_EMAILID4_0_, userregist0_.STR_FIRST_NAME as STR_FIRST_NAME5_0_, userregist0_.STR_LAST_NAME as STR_LAST_NAME6_0_, userregist0_.STR_MIDDLE_NAME as STR_MIDDLE_NAME7_0_, userregist0_.MOBILE as MOBILE8_0_, userregist0_.PASSWORD as PASSWORD9_0_, userregist0_.STR_USER_ID as STR_USER_ID10_0_, userregist0_.STR_USER_TYPE as STR_USER_TYPE11_0_ from SHOP_USER_REGISTRATION userregist0_ where userregist0_.STR_EMAILID='sonam@gmail.com'
list size : 0