mardi 26 août 2014

Hibernate criteraia not retrieving the data from database


Vote count:

0




Hi I am new bee to the Hibernate as I am Using the Criteria to retrieve the data from the database ,but I am unable to fetch the data if the record matches also. The below is the code snippet I used .The below method is mainly used to check whether the user in the list (groups) is admin or not by comparing with (QuickUrlAdmin table of adminUser column).


But I am getting the request1 size as 0 by checking in the logs (Records exists in the database) .Any suggestions



private boolean isAdmin() throws AppException {
try {
Session session = PersistenceManager.getSession();
Criteria criteria = session.createCriteria(QuickUrlAdmin.class);
List<QuickUrl> request1 = null;
for (String group : groups) { //groups is a list filled from another method
log.debug("group:" + group);
request1 =criteria.add(Restrictions.eq("adminUser", group)).list();
log.debug(" Request Object :" +request1.size());
}
}


asked 1 min ago







Hibernate criteraia not retrieving the data from database

Aucun commentaire:

Enregistrer un commentaire