[hibernate-dev] Storing values at the session level

Steve Ebersole steve at hibernate.org
Tue Mar 11 11:44:07 EDT 2014


I'm OK with exposing a getSessionOwner() method.  This could actually be
helpful in other places like envers iiuc.


On Mon, Mar 10, 2014 at 6:59 AM, Gunnar Morling <gunnar at hibernate.org>wrote:

> Hi,
>
> I'm looking into ways for reducing the number of datastore roundtrips in
> OGM [1].
>
> 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
> instance.
>
> 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,
>
> --Gunnar
>
> [1] https://hibernate.atlassian.net/browse/OGM-469
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list