-->
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.  [ 3 posts ] 
Author Message
 Post subject: Multiple Session Factories To One Database
PostPosted: Mon Mar 16, 2009 2:31 pm 
Newbie

Joined: Fri Jan 09, 2004 5:41 pm
Posts: 14
Hi,
Done a bit of research on my own and haven't found anything addressing the follow situation.

I have an application that runs on several separate machines, each being it's own separate and independent instance, all having session factories to the same database. I'd like to ensure that all db operations are written to the db asap so that other instances don't get stale data. I understand from the manual that flushing the session does this, but it mentions that unless you explicitly call flush, there's no guarantee when this happens.

Using Spring to get the session factory, an instance of org.springframework.orm.hibernate3.LocalSessionFactoryBean . Also using Spring to get the transaction manager, an instance of org.springframework.orm.hibernate3.HibernateTransactionManager .

Thanks in advance.
-Scott


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 17, 2009 1:38 pm 
Newbie

Joined: Fri Jan 09, 2004 5:41 pm
Posts: 14
Hm, I was guessing this was a common situation. Distributed application without clustered hibernate session?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 17, 2009 5:03 pm 
Newbie

Joined: Fri Nov 03, 2006 10:01 am
Posts: 6
Hi Scott-

Hibernate will flush your changes to the DB when your transaction commits. If you use Spring's transactions, then it happens whenever the transactional method completes.


So if an operation on Machine A commits the txn, the next time Machine B reads from the same table, it will see that new data.

Does that answer your question?

-Adam


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