Hi,

I am using hibernate and gwt. If I run the query in the main, the query returns 
the expected records.
But if I do the same query in a DAO, called by the web application 
methods, the result is always empty. It did work a few days ago, and I 
have not changed anything with this table. Is there any way I can trace 
it?

Thanks

The following are some extracted codes.

>From RPC, runs userinfodao.getUserinfoBySessId always return empty recordset.
publicvoidclearlogin(){HttpSessionsession 
=getThreadLocalRequest().getSession();UserinfoDAOuserinfodao 
=newUserinfoDAO();if(session !=null){Userinfouserinfo 
=userinfodao.getUserinfoBySessId(session.getId());userinfodao.removeUserinfo(userinfo.getOid());session.invalidate();}else{LogUtils.logInfo("Session
 has already been removed");}}


method from UserinfoDAO, that always doesn't work in gwt web app, but it is 
fine on 
mainpublicUserinfogetUserinfoBySessId(String_sessId){try{if(!session.isOpen()){session
 
=HibernateUtil.getSessionFactory().openSession();}LogUtils.logInfo("UserinfoDAO.getUserinfoBySessId
 "+_sessId );session.beginTransaction();Stringhql="from Userinfo userinfo where 
userinfo.sessId = :sessId";Queryquery 
=session.createQuery(hql);query.setString("sessId",_sessId);Listlist=query.list();UserinfotmpUserinfo=null;Iteratorit=list.iterator();while(it.hasNext()){tmpUserinfo=(Userinfo)it.next();}returntmpUserinfo;}catch(Exceptione){returnnull;}}

Run from main, it works as expected to return 
recordspublicstaticvoidmain(String[]args){UserinfoDAOuserinfodao=newUserinfoDAO();Userinfouserinfo
 
=newUserinfo();userinfo.setIp("172.16.95.102");userinfo.setTm(newDate());userinfo.setSessId("F30B837B52BB3E47D18B67A856C6A5AC");userinfo.setUsername("peter");userinfo.setAcctOid(111);userinfodao.insertUserinfo(userinfo);Userinfouserinfo1
 
=userinfodao.getUserinfoBySessId("F30B837B52BB3E47D18B67A856C6A5AC");System.out.println(userinfo1.getAcctOid());}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to