[hibernate-dev] Storing values at the session level

Emmanuel Bernard emmanuel at hibernate.org
Mon Mar 10 08:29:08 EDT 2014


Either this or have on the session owner contract a generic facility to store session specific data that OGM could extend. 
I think Steve has been reluctant of such contract in the past. We could re discuss the pluses and minuses. 

Another alternative is to use transactions as the payload transport. But the synchronization concept does not let you lookup for data outside the before and after tx events. 

Emmanuel 

> On 10 mars 2014, at 12:59, 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