-->
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: Configuration / ISessionFactory architecture best practice?
PostPosted: Wed Oct 26, 2005 6:34 am 
Beginner
Beginner

Joined: Thu Oct 20, 2005 9:26 am
Posts: 27
Location: Barcelona
Hi,

I'm trying to find a good way of handling the relationship between my business objects and the NHibernate configuration/session.

When do you think it's best to instantiate the configuration? Who is in charge of it? How do(n't) you reuse the sessionfactory?

What I lack is a general view of the architecture of this. I mean what should be encapsulated where and how to reuse it.

I hope I can get some suggestions.

Regards,
David Givoni


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 27, 2005 9:39 am 
Instantiating the Confguration is very time consuming so this should the configuration should be build and reused.

Now, the approach, as far as I consider is:
- instantiate configuration and session factory just once ( first time is needed or when the application starts)
- keep it somewhere so that it can be reused ( singleton, IOC, application )
- create an ISession for every:
- request - easier to implement, gets harder on complex logic with long business flows
- business flow (one or more pages in a user session share an ISession object) - the main problem IMHO is recovering from exceptions.
- anytime an "atomic" operation, independent of anything else occurs (logging in my opinion is standalone op)


Top
  
 
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.