-->
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.  [ 2 posts ] 
Author Message
 Post subject: Can I keep my Domain Model forever in memory
PostPosted: Tue May 14, 2013 1:57 am 
Newbie

Joined: Tue May 07, 2013 2:59 pm
Posts: 1
Hello,
All the hibernate examples I have seen so far more or less reconstruct the their Domain Object Model (DOM) on every service call.
So the flow is
1) service call A
2) Hibernate goes to DB and constructs the needed DOM
3) DOM returns result to service A
4) service call B
5) Hibernate goes to DB and constructs again the needed DOM
6) DOM returns result to service B
...
But I would much prefer the following:
1) At the beginning of my application I construct a DOM which can answer all server requests.
2) service call A
3) DOM returns result to service A
4)service call B
5) DOM returns result to service B
....
Since in most of the examples I `ve seen the first approach seems to be mostly used....
Is there something wrong with using
the second approach together with hibernate? Or is it just not practical for a enterprise application?


Top
 Profile  
 
 Post subject: Re: Can I keep my Domain Model forever in memory
PostPosted: Thu May 16, 2013 8:04 am 
Newbie

Joined: Sun Oct 02, 2005 12:49 am
Posts: 15
Session is equivalent to a Database Connection and has an associated transaction, which is the unit of work. In an enterprise application, you typically get a connection from a connection pool, use it and release it back to the pool as soon as possible.

From a performance stand point, you should probably start looking at hibernate's secondary level cache support rather than share connections/sessions.


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

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.