-->
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.  [ 4 posts ] 
Author Message
 Post subject: manager design
PostPosted: Wed Nov 02, 2005 9:54 am 
Newbie

Joined: Wed Nov 02, 2005 9:46 am
Posts: 1
Hi all,

I try to make a design with a big manager named ObjectDatabase which controll all db stuff of nhibernate.
I use nhibernate.Mapping.attributes instead of xml files.

My issue is the following:
I try to make a system wich commit to db only every 1 minute for example so for it i make a session object create only one time for all.
after i use this session for many transaction and query and I flush with a timer every 1 minute.
My probleme is to optimize all this manager.
- So is it good to have only 1 session build one time or must it be close each time i use it?
- Is there a solution to flush only one table and not all table (make one session by table??)
- Is all query on table will take the result from flushed thing or take data even if it is not commit?
- Is there a documentation which show best design pattern with nhibernate and not just example with 1 manager for each class?

thansk by advance for answer.

regards,
duff


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 3:41 pm 
Senior
Senior

Joined: Sat Sep 10, 2005 3:46 pm
Posts: 178
Sounds lke a risky idea to flusg based on a timer.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 5:20 am 
Regular
Regular

Joined: Fri Jun 11, 2004 6:27 am
Posts: 81
Location: Yaroslavl, Russia
On my opinion this is very weak architecture. At least, to use with NHibernate. Some possible problems:
1. NH session is not thread safe. You will have to somehow handle it yourself.
2. You accumulate changes and flush it once a minute. What will happen if flush would fail? Every change made during last minute could be lost and it's very hard to inform change originator about it.
3. NH session with very big amount of objects works slowly.
4. You are trying to move part of SQL server work into the application. You will have to think abut transactions isolation, atomicity and so on. It's way too hard.
5. What if your applcation will be terminated before minute-flush? All transactions made in the last minute will be lost.

_________________
Best,
Andrew Mayorov // BYTE-force


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 11:43 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Well said xor :)

duff, you should always use the session-per-request pattern unless you have specific requirements.

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.