private HibernateBeanManager hbm; //declare a member
public static getHibernateBeanManager() { //get method for the member
return hbm;
}
public static SessionFactory getSessionFactory() { //returning your session factory
.......
hbm = HibernateBeanManager.getInstance();
hbm.setSessionFactory(sessionFactory); //as per the hibernate4gwt tutorial
return sessionFactory;
}
In your server side implementation of the GWT service
(E.g.)
public class ServerGatewayServiceImpl extends HibernateRemoteService implements
ServerGatewayService {
public ServerGatewayServiceImpl(){
setBeanManager( HibernateUtil.getHibernateBeanManager() );
}
//other implemented methods to interface GWT here
}
This worked for me. Fingers crossed that it is in fact correct.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi All
I'm new to hibernate4gwt. I'm using it rather than the newer version Gilead because the tutorial to get started is better.
I've worked with hibernate successfully before but my understanding is limited.
On the tutorial here: http://hibernate4gwt.sourceforge.net/getting_started_stateless.html
the following is used:
public UserRemoteImpl()
{ setBeanManager((HibernateBeanManager)ApplicationContext.getInstance().getBean("hibernateBeanManager"));
}
I can't get this going, in any case I don't want all the stuff from the testApplication. I want to run in stateless mode.
What can I do to setBeanManager(..) simply in stateless mode.
I apologize in advance if this question has been asked before. I've searched in depth but cannot find the solution.
Thanks Very Much
J
Ok, for anybody interested here is the solution:
In your HibernateUtil file:
private HibernateBeanManager hbm; //declare a member
public static getHibernateBeanManager() { //get method for the member
return hbm;
}
public static SessionFactory getSessionFactory() { //returning your session factory
.......
hbm = HibernateBeanManager.getInstance();
hbm.setSessionFactory(sessionFactory); //as per the hibernate4gwt tutorial
return sessionFactory;
}
In your server side implementation of the GWT service
(E.g.)
public class ServerGatewayServiceImpl extends HibernateRemoteService implements
ServerGatewayService {
public ServerGatewayServiceImpl(){
setBeanManager( HibernateUtil.getHibernateBeanManager() );
}
//other implemented methods to interface GWT here
}
This worked for me. Fingers crossed that it is in fact correct.