-->
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: Hibernate Flush modes
PostPosted: Wed Sep 16, 2009 1:38 am 
Newbie

Joined: Wed Sep 16, 2009 1:24 am
Posts: 9
Hi,
I am new to hibernate, and I wish to get clarification regarding the Flushing operations in hibernate.
for eg If i tried to update a table in an extended session,

Will hibernate flush some of the changes to the database in the middle of transaction?(before completing the transaction)

If this is the case, when the data(data that has got flushed by hibernate) will be committed to the database ?
whether at the time of committing the transaction or at the time when hibernate flushing the data to DB itself.

Clarify me please.

Please find the hibernate properties that i am using in cfg.xml

transaction.manager_lookup_class = org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory
hibernate.transaction.flush_before_completion=true
hibernate.transaction.auto_close_session=true


Thanks in advance.


Top
 Profile  
 
 Post subject: Re: Hibernate Flush modes
PostPosted: Wed Sep 16, 2009 2:30 am 
Beginner
Beginner

Joined: Wed Jun 17, 2009 9:03 pm
Posts: 31
Location: mumbai
Hi

Hiberante can flush changes to database in following conditions.

1) Sometimes before execution of query.
2) When tranaction is commited.
3) When flush on session is called.
depending upon your flush mode selection.

If you do not want your data to be synchronized by hibernate before query execution
need the appropriate flush mode based on your requirement.


Top
 Profile  
 
 Post subject: Re: Hibernate Flush modes
PostPosted: Wed Sep 16, 2009 6:59 am 
Newbie

Joined: Wed Sep 16, 2009 1:24 am
Posts: 9
Thanks Prateek,

One more questions, if I set the transaction.flush_before_completion property to true, the data will be flushed at the time of transaction commit.

am I correct ?


Top
 Profile  
 
 Post subject: Re: Hibernate Flush modes
PostPosted: Wed Sep 16, 2009 9:38 am 
Beginner
Beginner

Joined: Wed Jun 17, 2009 9:03 pm
Posts: 31
Location: mumbai
Hi

According to the docs.

hibernate.transaction.flush_before_completion = true
If enabled, the session will be automatically flushed during the before completion phase of the transaction. Built-in and automatic session context management is preferred.


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.