[jboss-user] [EJB 3.0] - Wish to see hibernate acting and fixing this issue asap
nagkumar
do-not-reply at jboss.com
Wed Jun 11 13:45:46 EDT 2008
Hi have a User Object, which has many Relation Objects and we use OneToMany annotation for User attribute which has list of Relation objects it holds.
In order to find a perticular relation of the user, the commented approach results in 'cannot simultaneously fetch multiple bags'
However when I use the select stament, things work fine. Using Set instead of List is not applicable to us as we need to have get(i) and other behavious realted to List.
Session lSession = HibernateUtil.getTransactionSession();
Query query = lSession.createQuery(
"SELECT x FROM Relation x WHERE x.relation = :aRelation and x.user.loginID = :aLoginID");
query.setParameter("aRelation", aRelation);
query.setParameter("aLoginID", aLoginID);
Relation lRelation = (Relation) query.uniqueResult();
//Session session = HibernateUtil.getSession();
//Criteria cr = session.createCriteria(Relation.class);
//cr.add(Restrictions.ilike(Relation.FIELD_RELATION, aRelation));
//cr.createCriteria(UserAssociated.FIELD_USER).add(
// Restrictions.ilike(User.FIELD_LOGIN_ID, aLoginID));
//Relation lRelation = (Relation) cr.uniqueResult();
lSession.close();
return lRelation;
Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157470#4157470
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157470
More information about the jboss-user
mailing list