[hibernate-dev] Storing values at the session level
gunnar at hibernate.org
Mon Mar 10 08:32:45 EDT 2014
> Unfortunately there is no getter for the session owner on
2014-03-10 12:59 GMT+01:00 Gunnar Morling <gunnar at hibernate.org>:
> I'm looking into ways for reducing the number of datastore roundtrips in
> OGM .
> 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
> SessionFactoryImplementor, though.
> 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?
> Many thanks,
>  https://hibernate.atlassian.net/browse/OGM-469
More information about the hibernate-dev