-->
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.  [ 2 posts ] 
Author Message
 Post subject: Version Number is getting updated multiple times
PostPosted: Sun Oct 09, 2005 6:54 pm 
Newbie

Joined: Thu Mar 17, 2005 8:15 pm
Posts: 19
Hi,
I am trying to implement optimistic locking using hibernate and it is working fine. But I observed the version number is getting updated multiple times(and it is always starting with 6). Couple of months back, I implemented this in my prototype-and it worked fine.
Am I missing something here?. below is the xml mapping file and log (Orders table is updated multiple times)


<class
name="com.xxx.OrderDTO"
table="orders"
>
<id
name="orderNumber"
type="java.lang.Integer"
column="OrderNumber"

>
<generator class="increment"/>
</id>
<version name="version" column="VERSIONNUMBER"/>

<property-----
/>


<set
name="orderhistories"
inverse="true"
lazy = "false"
order-by="modifiedDate asc"
>
<key>
<column name="OrderNumber"/>
</key>
<one-to-many
class="com.xxx.OrderHistoryDTO"
/>
</set>


<bag
name="tasks"
inverse = "true"
>
<key>
<column name="OrderNumber"/>
</key>
<one-to-many
class="com.xxx.TaskDTO"
/>
</bag>


<joined-subclass
name="com.xxx.OrderBrochureDTO"
table="orderbrochure">
<key column="orderNumber"/>

<property
name="planNum"
type="java.lang.String"
column="PlanNum"
/>
<property
/>
</joined-subclass>

<joined-subclass
name="com.xxx.SalesMaterialOrderDTO"
table="OrderSalesMaterial"
entity-name="SalesMaterialOrderDTO"
>
<key column="orderNumber"/>


<property
/>

<joined-subclass
name="com.xxx.PermitOrderDTO"
table="OrderPermit"
>

<key column="orderNumber"/>

<property
/>


</joined-subclass>

</class>

</hibernate-mapping>

] Hibernate: insert into orders (VERSIONNUMBER, parentOrderNumber, specialInstructions, OrderTypeCod
e, DeltekProjectNumber, RequestedByID, OrderDate, EstCompletionDate, RevCompletionDate, DeltekTaskNu
mber, CostCenterPrefix, AssignedTo, OrderNumber) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
18:35:07,984 INFO [STDOUT] Hibernate: insert into OrderSalesMaterial (estimatedPrintDate, isBrochur
eInsertRequired, isSalesOfficeDisplayRequired, isBaseHousePlanRequired, isApprovedByManager, isOptio
nsPlanRequired, baseHouseGarageConfigCode, handOfHouseCode, quantity, planNum, orderNumber) values (
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
18:35:08,014 INFO [STDOUT] address DTO ---get ship to name willow grove
18:35:08,024 INFO [STDOUT] Hibernate: insert into OrderShippingAddress (ShipToName, StreetAddress,
City, StateCode, ZipCode, TelephoneNumber, FaxNumber, OrderNumber) values (?, ?, ?, ?, ?, ?, ?, ?)
18:35:08,054 INFO [STDOUT] Hibernate: update orders set VERSIONNUMBER=?, parentOrderNumber=?, speci
alInstructions=?, OrderTypeCode=?, DeltekProjectNumber=?, RequestedByID=?, OrderDate=?, EstCompletio
nDate=?, RevCompletionDate=?, DeltekTaskNumber=?, CostCenterPrefix=?, AssignedTo=? where OrderNumber
=? and VERSIONNUMBER=?
18:35:08,084 INFO [STDOUT] Hibernate: insert into OrderSalesMaterialArtWork (isRequireWallRendering
, artWorkId, elevationCode, planNum, OrderNumber, positionOfElevation) values (?, ?, ?, ?, ?, ?)
18:35:08,114 INFO [STDOUT] Hibernate: update orders set VERSIONNUMBER=?, parentOrderNumber=?, speci
alInstructions=?, OrderTypeCode=?, DeltekProjectNumber=?, RequestedByID=?, OrderDate=?, EstCompletio
nDate=?, RevCompletionDate=?, DeltekTaskNumber=?, CostCenterPrefix=?, AssignedTo=? where OrderNumber
=? and VERSIONNUMBER=?
18:35:08,144 INFO [STDOUT] Hibernate: insert into OrderSalesMaterialArtWork (isRequireWallRendering
, artWorkId, elevationCode, planNum, OrderNumber, positionOfElevation) values (?, ?, ?, ?, ?, ?)
18:35:08,164 INFO [STDOUT] Hibernate: update orders set VERSIONNUMBER=?, parentOrderNumber=?, speci
alInstructions=?, OrderTypeCode=?, DeltekProjectNumber=?, RequestedByID=?, OrderDate=?, EstCompletio
nDate=?, RevCompletionDate=?, DeltekTaskNumber=?, CostCenterPrefix=?, AssignedTo=? where OrderNumber
=? and VERSIONNUMBER=?
18:35:08,194 INFO [STDOUT] Hibernate: insert into OrderSalesMaterialOption (SequenceNumber, OrderNu
mber, OptionNumber, PlanNum, OptionMasterInstructionalCode) values (?, ?, ?, ?, ?)
18:35:08,214 INFO [STDOUT] Hibernate: update orders set VERSIONNUMBER=?, parentOrderNumber=?, speci
alInstructions=?, OrderTypeCode=?, DeltekProjectNumber=?, RequestedByID=?, OrderDate=?, EstCompletio
nDate=?, RevCompletionDate=?, DeltekTaskNumber=?, CostCenterPrefix=?, AssignedTo=? where OrderNumber
=? and VERSIONNUMBER=?
18:35:08,234 INFO [STDOUT] Hibernate: insert into orderhistory (Comment, OrderStatusCode, OrderType
Code, ModifiedByID, OrderNumber, ModifiedDate) values (?, ?, ?, ?, ?, ?)
18:35:08,264 INFO [STDOUT] Hibernate: update orders set VERSIONNUMBER=?, parentOrderNumber=?, speci
alInstructions=?, OrderTypeCode=?, DeltekProjectNumber=?, RequestedByID=?, OrderDate=?, EstCompletio
nDate=?, RevCompletionDate=?, DeltekTaskNumber=?, CostCenterPrefix=?, AssignedTo=? where OrderNumber
=? and VERSIONNUMBER=?
18:35:08,294 INFO [STDOUT] Hibernate: update orders set VERSIONNUMBER=?, parentOrderNumber=?, speci
alInstructions=?, OrderTypeCode=?, DeltekProjectNumber=?, RequestedByID=?, OrderDate=?, EstCompletio
nDate=?, RevCompletionDate=?, DeltekTaskNumber=?, CostCenterPrefix=?, AssignedTo=? where OrderNumber
=? and VERSIONNUMBER=?



Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 12:52 am 
Newbie

Joined: Fri Apr 01, 2005 5:21 am
Posts: 11
What are the version numbers of each of the records being inserted in the different tables?

Also, can you paste the piece of code that use use to save this?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.