[hibernate-dev] Storing values at the session level
gunnar at hibernate.org
Mon Mar 10 07:59:45 EDT 2014
I'm looking into ways for reducing the number of datastore roundtrips in
One idea is to fetch associations embedded within entity documents (e.g. in
MongoDB) when loading such document. We'd "remember" the entity document
and could later on retrieve the association from it without going to the
store a second time.
The problem is the "remembering" part. There is no session-scoped storage
facility as of today which I could use. I contemplated making OgmSession
deal with this, but I can't access that from persisters etc. Instead I'm
seeing the wrapped SessionImpl (to which OgmSession delegates for many
operations) and I couldn't find a way to reach the wrapping OgmSession
Now I noticed the concept of "SessionOwner" in SessionImpl and am wondering
whether I could make use of this. When creating the SessionImpl, I could
pass the OgmSession as owner and have it maintain a session-scoped storage.
Unfortunately there is no getter for the session owner on
Would it be feasible to add this getter and thus make a session's owner
accessible? Or is there any other (better) way to achieve what I described?
More information about the hibernate-dev