Probably it doe's not make sence to use "client/server" session, you can implement JDBC driver wrapper using RMI and deploy hibernate on client (
http://rmijdbc.objectweb.org/). As I understand it is more usefull to have "smart" serialization and lazy loading for entities returned by remote application methods.
It can be implemented using custom proxy serialization and using stateful session beans with client transactions to make it safe.
1) Implement statefull bean:
public interface Loader extends Remote {
Object initialize(Object handle);
}
2) Implement replacement object for serialization:
public class UninitializedEntity implements Serializable{
Object handle;
Object readReslove()throws ObjectStreamException{
return createProxy( handle );//CGLIB stuff to call "Loader" for remote initialization;
}
}
3) Implement custom persister to replace default proxy serialization
4) Use client transactions:
//servlet filter example
void doFilter( ... ){
InitialContext context = new InitialContext();
UserTransaction transaction = context.lookup("UserTransaction");
transaction.begin();
Loader loader = createRemoteBean(Loader.class);
//cache statefull bean in thread local variable
chain.doFilter(request,response);
transaction.commit();
//handle exception and release resources, close context, remove loader
}