1

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(); } 

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

11 Comments

Omg .. this was a problem . please give me some minutes to correct and check
Mobile variable i added only to check when um in the debug mode
Sir here return value is a object or a list?
Still the return value is null
Any more suggetions pls?
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.