-->
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.  [ 1 post ] 
Author Message
 Post subject: Does hibernate sessions in different JVMs can handle dirty r
PostPosted: Wed Jun 10, 2009 12:08 pm 
Newbie

Joined: Wed Jun 10, 2009 11:45 am
Posts: 1
Hi All,
Does hibernate sessions in different JVMs can handle dirty reads?
We have a single database instance accessed by multiple instances of the same web app. Each HTTP request opens the hibernate tranaction and closes it at the end of it.We do updates to inventory table on each request.Inventory table is mapped as below
<class name="Inventory" table="Inventory">
<id name="uid" column="uid" type="int" unsaved-value="-1">
<generator class="identity" />
</id>
<property name="quantityAvailable"/>
<property name="quantitySold"/>
<property name="inventoryForYear"/>
<property name="name"/>
<property name="soldOutDate"/>

</class>

inventory.setQuantitySold(inventory.getQuantitySold() + 1); to increase and using saveOrUpdate to update
inventory.setQuantitySold(inventory.getQuantitySold() - 1); to decrease using saveOrUpdate to update

As each app instance have its own hibernate session , is there any chance that inventory.getQuantitySold() result in a dirty read, i mean a value updated by instance 2, read by instance 1,and rolled back by instance 2.Does database take care of dirty reads issue or do i need to declare anything specific in hibernate mapping?

when we run SQL queries directly on DB,at the end of day,We see the difference between inventory table's quantitysold value and number of actual items sold.

Thanks,
rK


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.