Reputation: 101
What i want is to send Mobile number to the database and fetch Customer object. i debug following code and saw null customer object returned. Any help?
public Customer unSuccessfulLoginAttempts(String mobileNumber) {
log.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<| Unsuccessful Logging Attempts Repository Starting|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> {}" ,mobileNumber );
Session session = entityManager.unwrap(Session.class);
Criteria criteria = session.createCriteria(Customer.class,"c");
Criterion mobile = Restrictions.eq("c.phone1",mobileNumber);
criteria.add(Restrictions.eq("u.phone1", mobileNumber));
return (Customer) criteria.list();
}
Upvotes: 1
Views: 489
Reputation: 9492
From what I can see your alias is "c"
but you are using "u"
.
You need to have:
List customer = session.createCriteria(Customer.class)
.add(Restrictions.eq("phone1", mobileNumber))
.list();
Also your variable mobile remains unused.
Upvotes: 1