Hi
We're trying to integrate Hibernate with the corix 4i Framework (
http://www.corix.ch).
4i requires object identity within the live of one JVM process. AFAIK hibernate guarantees object identity only within one session. Thes drives me towards a session-per-application pattern.
Since the wiki entry
http://www.hibernate.org/168.html lists this as an anti pattern, I'd like to now what kind of problems I might face.
I already understood the following things:
- A session is not thread save. If I need thread savety I can maybe wrap the session with a synchronizing dynamic proxy.
- Getting a HibernateException means, that I've to stop the application. Well not perfect, but I think I shouldn't get HibernateExceptions during normal operation.
- The session caches every persistent object. This means it grows endlessly. AFAIK Session.clear() isn't an option, since this maybe violates object identity. Would it be possible to patch the session to use weak references for it's cache?
Any ideas are very welcome.
Ernst