aspose file tools*
The moose likes Object Relational Mapping and the fly likes hibernate versioning vs locking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "hibernate versioning vs locking" Watch "hibernate versioning vs locking" New topic
Author

hibernate versioning vs locking

Mike Okri
Ranch Hand

Joined: Jun 22, 2011
Posts: 83
I'm writing a hibernate application and I'm using hibernates automatic version checking to ensure that my transactions are properly isolated from each other. I'm doing this by adding the version property in all of my classes. Is this enough or do I also need to set an isolation level in my application? For example



I like automatic version checking, because it does not use locks.

I don't like to set an isolation level because it introduces locks.

Is it a good idea to mix optimistic and pessimistic transaction isolation. Or is it overkill?
Rishi Shehrawat
Ranch Hand

Joined: Aug 11, 2010
Posts: 218

You should use either one of them. Given a choice it is better to use Hibernate version because of reasons provided by you.
Mike Okri
Ranch Hand

Joined: Jun 22, 2011
Posts: 83
But the docs say that hibernate will use the default isolation level of the database if you don't specify an isolation level.
Mike Okri
Ranch Hand

Joined: Jun 22, 2011
Posts: 83
I guess automatic versioning will do and I'll use stricter locking where needed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: hibernate versioning vs locking