aspose file tools*
The moose likes Object Relational Mapping and the fly likes why to use session.beginTransaction & transaction.commit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "why to use session.beginTransaction & transaction.commit" Watch "why to use session.beginTransaction & transaction.commit" New topic
Author

why to use session.beginTransaction & transaction.commit

Krishnaa Kumar
Greenhorn

Joined: May 05, 2011
Posts: 25
Hibernate:
If any Transient object was added into hibernate session, why can't hibernate persist it(after its dirty checking) when i close the session. Is there any such of kind of option available.
Also, if such option exists, then why we are beginning a transaction & saying it to commit. (session.beginTransaction() )

what functionality that transaction.commit() does can also be done once we say session.close() right?
Kindly any one explain me about this.

thanks in advance.
-Krishna
Anurag Verma
Ranch Hand

Joined: Mar 30, 2012
Posts: 124

If you don't want to write code to begin & end transaction, you can use Spring & have annotation based transactions . but in that case Spring will handle starting & ending the transactions. i know i didn't answer your "why" part, i apologize for that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why to use session.beginTransaction & transaction.commit