-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: The CONTINUED session per DAO-retrieval pattern?
PostPosted: Tue Aug 07, 2007 7:07 pm 
Newbie

Joined: Tue Aug 07, 2007 5:33 pm
Posts: 4
Location: Stockholm
Let's say you still want to really abstract hibernate behind a DAO layer and not allow any db-writing from lower layers. But you really don't feel like writing all the DTO's or the code to assemble them.

Couldn't this be done in some soft fashion as follows:
Each DAO method that returns an entity, does this by opening a new session with flushmode never, loads the entity, stores the session hidden in the entity and returns the entity.

You can tamper with the entity all you want, nothing is persisted until you explicitly call the DAO update method which gets the session form the entity and flushes it. If this doesn't happen the session will just be disposed with the entity.

So you get a lot of sessions with isolated graphs, but if they don't overlap too much is that more expensive than one big session?

So what would be achieved? Well, at least something of a quasi DAO where you select graphs to be persisted/updated? I'm a total newbie on ORM, was this a horrible thought?

_________________
/Andreas Karlsson


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.