Hi Lukasz,
Thanks for the reply. About my test logic (which I'm starting to
believe that it's wrong) is this:
I want to test my Hibernate DAO (let's call it UserDAO) which extends
GWT's RemoteService, so my project looks like this:
- GWT
- com.gwt.client
- interface userDAO
- interface userDAOAsync
- com.gwt.server
- class userDAOImpl
And the actual DAO code is
public class UserDAOImpl extends RemoteServiceServlet implements
UserDAO {
@Override
public User getUserByNick(String nick) {
Session session =
HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
User res =
(User)session.createCriteria(User.class).add(Restrictions.eq("nickname",
nick)).uniqueResult();
session.getTransaction().commit();
return res;
}
}
That's the reason I need to go through the GWT Servlets to test my
DAO, because they are the same thing (which is why I think I made a
mistake somewhere).
Do you think there is a better way to do the same thing? Like, maybe I
should make a DAO in its own class in the server package and call it
via a new RPC class.
Thanks for the time.