-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem with Optimistic Locking and Detecting Real Changes
PostPosted: Wed May 11, 2005 11:39 am 
Beginner
Beginner

Joined: Thu Apr 21, 2005 12:15 pm
Posts: 34
hi I have a problem Using Optimistic Locking with Hibernate 2.1

I am using Hibernate within an Application Server (Websphere), we are using the Value Object/Transport Object pattern whereby the Hibernate Classes themselves are not passed to the Web Layer,instead Value Objects are.
When the user edits a record that ValueObject is passed back down to the EJB-Tier which creates a new instance of a Hibernate Class, populates it with the values in the the Value Object and does a session.update,session.flush. We have configured the mapping file with a suitable Version field, and provided getters and setters in it for the Hibernate class and the ValueObject.
This worked fine and we would receive the net.sf.hibernate.StaleObjectStateException as expected if a second user tried to update an outof date record.

The only problem was that if the first user hadnt actually changed anything we didnt want it to update the database and hence didnt want the Exception to occur for the 2nd user. i.e they had elected to edit a record, then pressed 'save' without changing anything.

Because we no longer have the original Hibernate class only the Value object I used get to retrieve the latest version
Code:
Session s = HibernateSessionFactory.currentSession();           
HibernateWidget widgetH = (HibernateWidget)s.get(HibernateWidget.class,widgetVO.getId());
widgetH.setLockNum(widgetVO.getLockNum());
widgetH.setName(widgetVO.getName());
.....
s.update(ptfPortfolio);
s.flush();


this worked, for the 1st user it only actually did an update if they had actually changed a value.

Unfortunately this broke the lock numbering ! If the 1st user had made a change the 2nd users change would still work. I think this is because when i issue the get it retrives the latest record (i.e user 1's update) then when I write to the database Hibernate knows it has the latest record in the database and allows the update, ignoring the fact that I set the lock number to the value specified in the ValueObject (an earlier value).

How can I get round this problem. (BTW my sql output for update shows that prepared statements are being used so unfortunately I cant see exactly what Hibernate is writing)


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 10:21 am 
Beginner
Beginner

Joined: Thu Apr 21, 2005 12:15 pm
Posts: 34
Ive managed to get tracing on at long last.

The first listing shows a valid update, the second listing shows an invalid update that Hibernate accepts as valid rather than rejecting it.
the key difference is that in the second case it notes that the hibernate lock_num is dirty but that doesnt trigger it to throw a stale object exception it just increments the number to a later value.

Ive also listed what happens when I dont check for saves that havent really changed. The third listing shows a valid update when I dont use the get() method. The fourth listing shows an attempt to do an invalid update whereby Hibernate throws the correct exception. the fifth listing shows the problem I was originally trying to address, even though havent actaully saved anything Hibernate still does a save.

Anyone got any ideas, Im sure I cant be the first to have encountered this problem.

Listing 1
Code:
[12/05/05 15:03:25:371 BST] 0000002f PortfolioBean I   Entering:updatePortfolio
[12/05/05 15:03:25:371 BST] 0000002f PortfolioDAO  I   Entering:update
[12/05/05 15:03:25:371 BST] 0000002f SessionImpl   3   opened session
[12/05/05 15:03:25:371 BST] 0000002f SessionImpl   1   loading [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:03:25:371 BST] 0000002f SessionImpl   1   attempting to resolve [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:03:25:371 BST] 0000002f SessionImpl   1   object not resolved in any cache [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:03:25:371 BST] 0000002f EntityPersist 1   Materializing entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:03:25:371 BST] 0000002f BatcherImpl   1   about to open: 0 open PreparedStatements, 0 open ResultSets
[12/05/05 15:03:25:371 BST] 0000002f SQL           3   select ptfportfol0_.PTF_PK as PTF_PK2_, ptfportfol0_.LOCK_NUM as LOCK_NUM2_, ptfportfol0_.NAME as NAME2_, ptfportfol0_.DESCRIPTION as DESCRIPT4_2_, ptfportfol0_.VOLUME as VOLUME2_, ptfportfol0_.CLASS as CLASS2_, ptfportfol0_.CREATION_DT as CREATION7_2_, ptfportfol0_.PTT_FK as PTT_FK2_, ptfportfol0_.USR_FK as USR_FK2_, portfoliot1_.PTT_PK as PTT_PK0_, portfoliot1_.NAME as NAME0_, user2_.USR_PK as USR_PK1_, user2_.DELETED as DELETED1_, user2_.NAME as NAME1_, user2_.DESCRIPTION as DESCRIPT4_1_, user2_.PASSWORD as PASSWORD1_ from PTF_PORTFOLIO ptfportfol0_, PTT_PORTFOLIO_TYPE portfoliot1_, USR_USER user2_ where ptfportfol0_.PTF_PK=? and ptfportfol0_.PTT_FK=portfoliot1_.PTT_PK(+) and ptfportfol0_.USR_FK=user2_.USR_PK(+)
[12/05/05 15:03:25:371 BST] 0000002f SystemOut     O   Hibernate: select ptfportfol0_.PTF_PK as PTF_PK2_, ptfportfol0_.LOCK_NUM as LOCK_NUM2_, ptfportfol0_.NAME as NAME2_, ptfportfol0_.DESCRIPTION as DESCRIPT4_2_, ptfportfol0_.VOLUME as VOLUME2_, ptfportfol0_.CLASS as CLASS2_, ptfportfol0_.CREATION_DT as CREATION7_2_, ptfportfol0_.PTT_FK as PTT_FK2_, ptfportfol0_.USR_FK as USR_FK2_, portfoliot1_.PTT_PK as PTT_PK0_, portfoliot1_.NAME as NAME0_, user2_.USR_PK as USR_PK1_, user2_.DELETED as DELETED1_, user2_.NAME as NAME1_, user2_.DESCRIPTION as DESCRIPT4_1_, user2_.PASSWORD as PASSWORD1_ from PTF_PORTFOLIO ptfportfol0_, PTT_PORTFOLIO_TYPE portfoliot1_, USR_USER user2_ where ptfportfol0_.PTF_PK=? and ptfportfol0_.PTT_FK=portfoliot1_.PTT_PK(+) and ptfportfol0_.USR_FK=user2_.USR_PK(+)
[12/05/05 15:03:25:386 BST] 0000002f BatcherImpl   1   preparing statement
[12/05/05 15:03:25:386 BST] 0000002f LongType      1   binding '24' to parameter: 1
[12/05/05 15:03:25:543 BST] 0000002f Loader        1   processing result set
[12/05/05 15:03:25:543 BST] 0000002f LongType      1   returning '1' as column: PTT_PK0_
[12/05/05 15:03:25:543 BST] 0000002f LongType      1   returning '1' as column: USR_PK1_
[12/05/05 15:03:25:543 BST] 0000002f Loader        3   result row: 1, 1, 24
[12/05/05 15:03:25:543 BST] 0000002f Loader        1   Initializing object from ResultSet: 1
[12/05/05 15:03:25:543 BST] 0000002f Loader        1   Hydrating entity: com.abnamro.att.server.portfolios.domain.PortfolioType#1
[12/05/05 15:03:25:543 BST] 0000002f StringType    1   returning 'Long' as column: NAME0_
[12/05/05 15:03:25:543 BST] 0000002f Loader        1   Initializing object from ResultSet: 1
[12/05/05 15:03:25:543 BST] 0000002f Loader        1   Hydrating entity: com.abnamro.att.server.security.domain.User#1
[12/05/05 15:03:25:543 BST] 0000002f BooleanType   1   returning null as column: DELETED1_
[12/05/05 15:03:25:558 BST] 0000002f StringType    1   returning 'Test User' as column: NAME1_
[12/05/05 15:03:25:558 BST] 0000002f StringType    1   returning 'Test Description' as column: DESCRIPT4_1_
[12/05/05 15:03:25:558 BST] 0000002f StringType    1   returning null as column: PASSWORD1_
[12/05/05 15:03:25:558 BST] 0000002f Loader        1   Initializing object from ResultSet: 24
[12/05/05 15:03:25:558 BST] 0000002f Loader        1   Hydrating entity: com.abnamro.att.server.portfolios.domain.PtfPortfolio#24
[12/05/05 15:03:25:558 BST] 0000002f LongType      1   returning '1' as column: LOCK_NUM2_
[12/05/05 15:03:25:558 BST] 0000002f StringType    1   returning 'Test1' as column: NAME2_
[12/05/05 15:03:25:558 BST] 0000002f StringType    1   returning 'Test6' as column: DESCRIPT4_2_
[12/05/05 15:03:25:558 BST] 0000002f LongType      1   returning null as column: VOLUME2_
[12/05/05 15:03:25:558 BST] 0000002f StringType    1   returning 'T' as column: CLASS2_
[12/05/05 15:03:25:558 BST] 0000002f TimestampType 1   returning '2005-05-11 11:10:13' as column: CREATION7_2_
[12/05/05 15:03:25:558 BST] 0000002f LongType      1   returning '1' as column: PTT_FK2_
[12/05/05 15:03:25:558 BST] 0000002f LongType      1   returning '1' as column: USR_FK2_
[12/05/05 15:03:25:558 BST] 0000002f SessionImpl   1   Version: 1
[12/05/05 15:03:25:558 BST] 0000002f Loader        1   done processing result set (1 rows)
[12/05/05 15:03:25:558 BST] 0000002f BatcherImpl   1   done closing: 0 open PreparedStatements, 0 open ResultSets
[12/05/05 15:03:25:558 BST] 0000002f BatcherImpl   1   closing statement
[12/05/05 15:03:25:558 BST] 0000002f Loader        1   total objects hydrated: 3
[12/05/05 15:03:25:558 BST] 0000002f SessionImpl   3   resolving associations for [com.abnamro.att.server.portfolios.domain.PortfolioType#1]
[12/05/05 15:03:25:558 BST] 0000002f SessionImpl   3   done materializing entity [com.abnamro.att.server.portfolios.domain.PortfolioType#1]
[12/05/05 15:03:25:558 BST] 0000002f SessionImpl   3   resolving associations for [com.abnamro.att.server.security.domain.User#1]
[12/05/05 15:03:25:558 BST] 0000002f SessionImpl   3   done materializing entity [com.abnamro.att.server.security.domain.User#1]
[12/05/05 15:03:25:558 BST] 0000002f SessionImpl   3   resolving associations for [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:03:25:558 BST] 0000002f SessionImpl   1   loading [com.abnamro.att.server.portfolios.domain.PortfolioType#1]
[12/05/05 15:03:25:558 BST] 0000002f SessionImpl   1   attempting to resolve [com.abnamro.att.server.portfolios.domain.PortfolioType#1]
[12/05/05 15:03:25:558 BST] 0000002f SessionImpl   1   resolved object in session cache [com.abnamro.att.server.portfolios.domain.PortfolioType#1]
[12/05/05 15:03:25:558 BST] 0000002f SessionImpl   1   loading [com.abnamro.att.server.security.domain.User#1]
[12/05/05 15:03:25:558 BST] 0000002f SessionImpl   1   attempting to resolve [com.abnamro.att.server.security.domain.User#1]
[12/05/05 15:03:25:558 BST] 0000002f SessionImpl   1   resolved object in session cache [com.abnamro.att.server.security.domain.User#1]
[12/05/05 15:03:25:558 BST] 0000002f SessionImpl   3   done materializing entity [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:03:25:558 BST] 0000002f SessionImpl   3   initializing non-lazy collections
[12/05/05 15:03:25:558 BST] 0000002f PortfolioDAO  I   Retrieved latest version from db:
[12/05/05 15:03:25:558 BST] 0000002f PortfolioDAO  I   Lock Num from latest record in database is:1
[12/05/05 15:03:25:558 BST] 0000002f PortfolioDAO  I   Lock Num from vo object is:1
[12/05/05 15:03:25:558 BST] 0000002f PortfolioDAO  I   Lock Num from latest ptf object updated from vo is:1
[12/05/05 15:03:25:574 BST] 0000002f SessionImpl   1   object already associated with session
[12/05/05 15:03:25:574 BST] 0000002f SessionImpl   1   flushing session
[12/05/05 15:03:25:574 BST] 0000002f SessionImpl   1   Flushing entities and processing referenced collections
[12/05/05 15:03:25:574 BST] 0000002f Cascades      1   id unsaved-value strategy NULL
[12/05/05 15:03:25:574 BST] 0000002f Cascades      1   id unsaved-value strategy NULL
[12/05/05 15:03:25:574 BST] 0000002f AbstractEntit 1   com.abnamro.att.server.portfolios.domain.PtfPortfolio.description is dirty
[12/05/05 15:03:25:574 BST] 0000002f SessionImpl   1   Updating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:03:25:574 BST] 0000002f Versioning    1   Incrementing: 1 to 2
[12/05/05 15:03:25:574 BST] 0000002f SessionImpl   1   Processing unreferenced collections
[12/05/05 15:03:25:574 BST] 0000002f SessionImpl   1   Scheduling collection removes/(re)creates/updates
[12/05/05 15:03:25:574 BST] 0000002f SessionImpl   3   Flushed: 0 insertions, 1 updates, 0 deletions to 3 objects
[12/05/05 15:03:25:574 BST] 0000002f SessionImpl   3   Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
[12/05/05 15:03:25:574 BST] 0000002f Printer       3   listing entities:
[12/05/05 15:03:25:574 BST] 0000002f Printer       3   com.abnamro.att.server.security.domain.User{password=null, deleted=null, description=Test Description, name=Test User, id=1}
[12/05/05 15:03:25:574 BST] 0000002f Printer       3   com.abnamro.att.server.portfolios.domain.PortfolioType{name=Long, id=1}
[12/05/05 15:03:25:574 BST] 0000002f Printer       3   com.abnamro.att.server.portfolios.domain.PtfPortfolio{volume=null, type=PortfolioType#1, owner=User#1, description=THISSHOULDWORK, creationDate=2005-05-11 11:10:13, name=Test1, lockNum=1, id=24, pclass=T}
[12/05/05 15:03:25:574 BST] 0000002f SessionImpl   1   executing flush
[12/05/05 15:03:25:574 BST] 0000002f EntityPersist 1   Updating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:03:25:574 BST] 0000002f EntityPersist 1   Existing version: 1 -> New version: 2
[12/05/05 15:03:25:574 BST] 0000002f BatcherImpl   1   about to open: 0 open PreparedStatements, 0 open ResultSets
[12/05/05 15:03:25:574 BST] 0000002f SQL           3   update PTF_PORTFOLIO set LOCK_NUM=?, NAME=?, DESCRIPTION=?, VOLUME=?, CLASS=?, CREATION_DT=?, PTT_FK=?, USR_FK=? where PTF_PK=? and LOCK_NUM=?
[12/05/05 15:03:25:574 BST] 0000002f SystemOut     O   Hibernate: update PTF_PORTFOLIO set LOCK_NUM=?, NAME=?, DESCRIPTION=?, VOLUME=?, CLASS=?, CREATION_DT=?, PTT_FK=?, USR_FK=? where PTF_PK=? and LOCK_NUM=?
[12/05/05 15:03:25:574 BST] 0000002f BatcherImpl   1   preparing statement
[12/05/05 15:03:25:574 BST] 0000002f EntityPersist 1   Dehydrating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:03:25:574 BST] 0000002f LongType      1   binding '2' to parameter: 1
[12/05/05 15:03:25:574 BST] 0000002f StringType    1   binding 'Test1' to parameter: 2
[12/05/05 15:03:25:574 BST] 0000002f StringType    1   binding 'THISSHOULDWORK' to parameter: 3
[12/05/05 15:03:25:574 BST] 0000002f LongType      1   binding null to parameter: 4
[12/05/05 15:03:25:574 BST] 0000002f StringType    1   binding 'T' to parameter: 5
[12/05/05 15:03:25:574 BST] 0000002f TimestampType 1   binding '2005-05-11 11:10:13' to parameter: 6
[12/05/05 15:03:25:574 BST] 0000002f Cascades      1   id unsaved-value strategy NULL
[12/05/05 15:03:25:574 BST] 0000002f LongType      1   binding '1' to parameter: 7
[12/05/05 15:03:25:574 BST] 0000002f Cascades      1   id unsaved-value strategy NULL
[12/05/05 15:03:25:574 BST] 0000002f LongType      1   binding '1' to parameter: 8
[12/05/05 15:03:25:574 BST] 0000002f LongType      1   binding '24' to parameter: 9
[12/05/05 15:03:25:574 BST] 0000002f LongType      1   binding '1' to parameter: 10
[12/05/05 15:03:25:574 BST] 0000002f BatcherImpl   1   done closing: 0 open PreparedStatements, 0 open ResultSets
[12/05/05 15:03:25:574 BST] 0000002f BatcherImpl   1   closing statement
[12/05/05 15:03:25:574 BST] 0000002f SessionImpl   1   post flush
[12/05/05 15:03:25:574 BST] 0000002f SessionImpl   1   closing session
[12/05/05 15:03:25:574 BST] 0000002f SessionImpl   3   disconnecting session
[12/05/05 15:03:25:574 BST] 0000002f PortfolioDAO  I   Exiting:update
[12/05/05 15:03:25:589 BST] 0000002f PortfolioBean I   Exiting:updatePortfolio


Listing 2
Code:
[12/05/05 15:04:56:324 BST] 0000002f PortfolioBean I   Entering:updatePortfolio
[12/05/05 15:04:56:340 BST] 0000002f PortfolioDAO  I   Entering:update
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   3   opened session
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   1   loading [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   1   attempting to resolve [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   1   object not resolved in any cache [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:04:56:340 BST] 0000002f EntityPersist 1   Materializing entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:04:56:340 BST] 0000002f BatcherImpl   1   about to open: 0 open PreparedStatements, 0 open ResultSets
[12/05/05 15:04:56:340 BST] 0000002f SQL           3   select ptfportfol0_.PTF_PK as PTF_PK2_, ptfportfol0_.LOCK_NUM as LOCK_NUM2_, ptfportfol0_.NAME as NAME2_, ptfportfol0_.DESCRIPTION as DESCRIPT4_2_, ptfportfol0_.VOLUME as VOLUME2_, ptfportfol0_.CLASS as CLASS2_, ptfportfol0_.CREATION_DT as CREATION7_2_, ptfportfol0_.PTT_FK as PTT_FK2_, ptfportfol0_.USR_FK as USR_FK2_, portfoliot1_.PTT_PK as PTT_PK0_, portfoliot1_.NAME as NAME0_, user2_.USR_PK as USR_PK1_, user2_.DELETED as DELETED1_, user2_.NAME as NAME1_, user2_.DESCRIPTION as DESCRIPT4_1_, user2_.PASSWORD as PASSWORD1_ from PTF_PORTFOLIO ptfportfol0_, PTT_PORTFOLIO_TYPE portfoliot1_, USR_USER user2_ where ptfportfol0_.PTF_PK=? and ptfportfol0_.PTT_FK=portfoliot1_.PTT_PK(+) and ptfportfol0_.USR_FK=user2_.USR_PK(+)
[12/05/05 15:04:56:340 BST] 0000002f SystemOut     O   Hibernate: select ptfportfol0_.PTF_PK as PTF_PK2_, ptfportfol0_.LOCK_NUM as LOCK_NUM2_, ptfportfol0_.NAME as NAME2_, ptfportfol0_.DESCRIPTION as DESCRIPT4_2_, ptfportfol0_.VOLUME as VOLUME2_, ptfportfol0_.CLASS as CLASS2_, ptfportfol0_.CREATION_DT as CREATION7_2_, ptfportfol0_.PTT_FK as PTT_FK2_, ptfportfol0_.USR_FK as USR_FK2_, portfoliot1_.PTT_PK as PTT_PK0_, portfoliot1_.NAME as NAME0_, user2_.USR_PK as USR_PK1_, user2_.DELETED as DELETED1_, user2_.NAME as NAME1_, user2_.DESCRIPTION as DESCRIPT4_1_, user2_.PASSWORD as PASSWORD1_ from PTF_PORTFOLIO ptfportfol0_, PTT_PORTFOLIO_TYPE portfoliot1_, USR_USER user2_ where ptfportfol0_.PTF_PK=? and ptfportfol0_.PTT_FK=portfoliot1_.PTT_PK(+) and ptfportfol0_.USR_FK=user2_.USR_PK(+)
[12/05/05 15:04:56:340 BST] 0000002f BatcherImpl   1   preparing statement
[12/05/05 15:04:56:340 BST] 0000002f LongType      1   binding '24' to parameter: 1
[12/05/05 15:04:56:340 BST] 0000002f Loader        1   processing result set
[12/05/05 15:04:56:340 BST] 0000002f LongType      1   returning '1' as column: PTT_PK0_
[12/05/05 15:04:56:340 BST] 0000002f LongType      1   returning '1' as column: USR_PK1_
[12/05/05 15:04:56:340 BST] 0000002f Loader        3   result row: 1, 1, 24
[12/05/05 15:04:56:340 BST] 0000002f Loader        1   Initializing object from ResultSet: 1
[12/05/05 15:04:56:340 BST] 0000002f Loader        1   Hydrating entity: com.abnamro.att.server.portfolios.domain.PortfolioType#1
[12/05/05 15:04:56:340 BST] 0000002f StringType    1   returning 'Long' as column: NAME0_
[12/05/05 15:04:56:340 BST] 0000002f Loader        1   Initializing object from ResultSet: 1
[12/05/05 15:04:56:340 BST] 0000002f Loader        1   Hydrating entity: com.abnamro.att.server.security.domain.User#1
[12/05/05 15:04:56:340 BST] 0000002f BooleanType   1   returning null as column: DELETED1_
[12/05/05 15:04:56:340 BST] 0000002f StringType    1   returning 'Test User' as column: NAME1_
[12/05/05 15:04:56:340 BST] 0000002f StringType    1   returning 'Test Description' as column: DESCRIPT4_1_
[12/05/05 15:04:56:340 BST] 0000002f StringType    1   returning null as column: PASSWORD1_
[12/05/05 15:04:56:340 BST] 0000002f Loader        1   Initializing object from ResultSet: 24
[12/05/05 15:04:56:340 BST] 0000002f Loader        1   Hydrating entity: com.abnamro.att.server.portfolios.domain.PtfPortfolio#24
[12/05/05 15:04:56:340 BST] 0000002f LongType      1   returning '2' as column: LOCK_NUM2_
[12/05/05 15:04:56:340 BST] 0000002f StringType    1   returning 'Test1' as column: NAME2_
[12/05/05 15:04:56:340 BST] 0000002f StringType    1   returning 'THISSHOULDWORK' as column: DESCRIPT4_2_
[12/05/05 15:04:56:340 BST] 0000002f LongType      1   returning null as column: VOLUME2_
[12/05/05 15:04:56:340 BST] 0000002f StringType    1   returning 'T' as column: CLASS2_
[12/05/05 15:04:56:340 BST] 0000002f TimestampType 1   returning '2005-05-11 11:10:13' as column: CREATION7_2_
[12/05/05 15:04:56:340 BST] 0000002f LongType      1   returning '1' as column: PTT_FK2_
[12/05/05 15:04:56:340 BST] 0000002f LongType      1   returning '1' as column: USR_FK2_
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   1   Version: 2
[12/05/05 15:04:56:340 BST] 0000002f Loader        1   done processing result set (1 rows)
[12/05/05 15:04:56:340 BST] 0000002f BatcherImpl   1   done closing: 0 open PreparedStatements, 0 open ResultSets
[12/05/05 15:04:56:340 BST] 0000002f BatcherImpl   1   closing statement
[12/05/05 15:04:56:340 BST] 0000002f Loader        1   total objects hydrated: 3
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   3   resolving associations for [com.abnamro.att.server.portfolios.domain.PortfolioType#1]
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   3   done materializing entity [com.abnamro.att.server.portfolios.domain.PortfolioType#1]
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   3   resolving associations for [com.abnamro.att.server.security.domain.User#1]
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   3   done materializing entity [com.abnamro.att.server.security.domain.User#1]
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   3   resolving associations for [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   1   loading [com.abnamro.att.server.portfolios.domain.PortfolioType#1]
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   1   attempting to resolve [com.abnamro.att.server.portfolios.domain.PortfolioType#1]
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   1   resolved object in session cache [com.abnamro.att.server.portfolios.domain.PortfolioType#1]
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   1   loading [com.abnamro.att.server.security.domain.User#1]
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   1   attempting to resolve [com.abnamro.att.server.security.domain.User#1]
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   1   resolved object in session cache [com.abnamro.att.server.security.domain.User#1]
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   3   done materializing entity [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:04:56:340 BST] 0000002f SessionImpl   3   initializing non-lazy collections
[12/05/05 15:04:56:340 BST] 0000002f PortfolioDAO  I   Retrieved latest version from db:
[12/05/05 15:04:56:402 BST] 0000002f PortfolioDAO  I   Lock Num from latest record in database is:2
[12/05/05 15:04:56:402 BST] 0000002f PortfolioDAO  I   Lock Num from vo object is:1
[12/05/05 15:04:56:418 BST] 0000002f PortfolioDAO  I   Lock Num from latest ptf object updated from vo is:1
[12/05/05 15:04:56:418 BST] 0000002f SessionImpl   1   object already associated with session
[12/05/05 15:04:56:418 BST] 0000002f SessionImpl   1   flushing session
[12/05/05 15:04:56:418 BST] 0000002f SessionImpl   1   Flushing entities and processing referenced collections
[12/05/05 15:04:56:418 BST] 0000002f Cascades      1   id unsaved-value strategy NULL
[12/05/05 15:04:56:418 BST] 0000002f Cascades      1   id unsaved-value strategy NULL
[12/05/05 15:04:56:418 BST] 0000002f AbstractEntit 1   com.abnamro.att.server.portfolios.domain.PtfPortfolio.lockNum is dirty
[12/05/05 15:04:56:418 BST] 0000002f AbstractEntit 1   com.abnamro.att.server.portfolios.domain.PtfPortfolio.description is dirty
[12/05/05 15:04:56:418 BST] 0000002f SessionImpl   1   Updating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:04:56:418 BST] 0000002f Versioning    1   Incrementing: 2 to 3
[12/05/05 15:04:56:418 BST] 0000002f SessionImpl   1   Processing unreferenced collections
[12/05/05 15:04:56:418 BST] 0000002f SessionImpl   1   Scheduling collection removes/(re)creates/updates
[12/05/05 15:04:56:418 BST] 0000002f SessionImpl   3   Flushed: 0 insertions, 1 updates, 0 deletions to 3 objects
[12/05/05 15:04:56:418 BST] 0000002f SessionImpl   3   Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
[12/05/05 15:04:56:418 BST] 0000002f Printer       3   listing entities:
[12/05/05 15:04:56:418 BST] 0000002f Printer       3   com.abnamro.att.server.security.domain.User{password=null, deleted=null, description=Test Description, name=Test User, id=1}
[12/05/05 15:04:56:418 BST] 0000002f Printer       3   com.abnamro.att.server.portfolios.domain.PortfolioType{name=Long, id=1}
[12/05/05 15:04:56:418 BST] 0000002f Printer       3   com.abnamro.att.server.portfolios.domain.PtfPortfolio{volume=null, type=PortfolioType#1, owner=User#1, description=THISSHOULDFAIL, creationDate=2005-05-11 11:10:13, name=Test1, lockNum=1, id=24, pclass=T}
[12/05/05 15:04:56:418 BST] 0000002f SessionImpl   1   executing flush
[12/05/05 15:04:56:418 BST] 0000002f EntityPersist 1   Updating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:04:56:418 BST] 0000002f EntityPersist 1   Existing version: 2 -> New version: 3
[12/05/05 15:04:56:418 BST] 0000002f BatcherImpl   1   about to open: 0 open PreparedStatements, 0 open ResultSets
[12/05/05 15:04:56:418 BST] 0000002f SQL           3   update PTF_PORTFOLIO set LOCK_NUM=?, NAME=?, DESCRIPTION=?, VOLUME=?, CLASS=?, CREATION_DT=?, PTT_FK=?, USR_FK=? where PTF_PK=? and LOCK_NUM=?
[12/05/05 15:04:56:418 BST] 0000002f SystemOut     O   Hibernate: update PTF_PORTFOLIO set LOCK_NUM=?, NAME=?, DESCRIPTION=?, VOLUME=?, CLASS=?, CREATION_DT=?, PTT_FK=?, USR_FK=? where PTF_PK=? and LOCK_NUM=?
[12/05/05 15:04:56:418 BST] 0000002f BatcherImpl   1   preparing statement
[12/05/05 15:04:56:418 BST] 0000002f EntityPersist 1   Dehydrating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:04:56:418 BST] 0000002f LongType      1   binding '3' to parameter: 1
[12/05/05 15:04:56:418 BST] 0000002f StringType    1   binding 'Test1' to parameter: 2
[12/05/05 15:04:56:418 BST] 0000002f StringType    1   binding 'THISSHOULDFAIL' to parameter: 3
[12/05/05 15:04:56:418 BST] 0000002f LongType      1   binding null to parameter: 4
[12/05/05 15:04:56:418 BST] 0000002f StringType    1   binding 'T' to parameter: 5
[12/05/05 15:04:56:418 BST] 0000002f TimestampType 1   binding '2005-05-11 11:10:13' to parameter: 6
[12/05/05 15:04:56:418 BST] 0000002f Cascades      1   id unsaved-value strategy NULL
[12/05/05 15:04:56:418 BST] 0000002f LongType      1   binding '1' to parameter: 7
[12/05/05 15:04:56:418 BST] 0000002f Cascades      1   id unsaved-value strategy NULL
[12/05/05 15:04:56:418 BST] 0000002f LongType      1   binding '1' to parameter: 8
[12/05/05 15:04:56:418 BST] 0000002f LongType      1   binding '24' to parameter: 9
[12/05/05 15:04:56:418 BST] 0000002f LongType      1   binding '2' to parameter: 10
[12/05/05 15:04:56:418 BST] 0000002f BatcherImpl   1   done closing: 0 open PreparedStatements, 0 open ResultSets
[12/05/05 15:04:56:418 BST] 0000002f BatcherImpl   1   closing statement
[12/05/05 15:04:56:418 BST] 0000002f SessionImpl   1   post flush
[12/05/05 15:04:56:418 BST] 0000002f SessionImpl   1   closing session
[12/05/05 15:04:56:418 BST] 0000002f SessionImpl   3   disconnecting session
[12/05/05 15:04:56:418 BST] 0000002f PortfolioDAO  I   Exiting:update


Listing 3
Code:
[12/05/05 15:15:10:360 BST] 00000032 PortfolioBean I   Entering:updatePortfolio
[12/05/05 15:15:10:360 BST] 00000032 PortfolioDAO  I   Entering:update
[12/05/05 15:15:10:360 BST] 00000032 SessionImpl   3   opened session
[12/05/05 15:15:10:360 BST] 00000032 SessionImpl   1   updating [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:15:10:375 BST] 00000032 SessionImpl   1   flushing session
[12/05/05 15:15:10:375 BST] 00000032 SessionImpl   1   Flushing entities and processing referenced collections
[12/05/05 15:15:10:375 BST] 00000032 SessionImpl   1   Updating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:15:10:375 BST] 00000032 Versioning    1   Incrementing: 3 to 4
[12/05/05 15:15:10:375 BST] 00000032 SessionImpl   1   Processing unreferenced collections
[12/05/05 15:15:10:375 BST] 00000032 SessionImpl   1   Scheduling collection removes/(re)creates/updates
[12/05/05 15:15:10:375 BST] 00000032 SessionImpl   3   Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects
[12/05/05 15:15:10:375 BST] 00000032 SessionImpl   3   Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
[12/05/05 15:15:10:375 BST] 00000032 Printer       3   listing entities:
[12/05/05 15:15:10:375 BST] 00000032 Printer       3   com.abnamro.att.server.portfolios.domain.PtfPortfolio{volume=null, type=PortfolioType#1, owner=User#1, description=THISSHOULDWORKGO2, creationDate=2005-05-11 11:10:13, name=Test1, lockNum=3, id=24, pclass=T}
[12/05/05 15:15:10:375 BST] 00000032 SessionImpl   1   executing flush
[12/05/05 15:15:10:375 BST] 00000032 EntityPersist 1   Updating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:15:10:375 BST] 00000032 EntityPersist 1   Existing version: 3 -> New version: 4
[12/05/05 15:15:10:375 BST] 00000032 BatcherImpl   1   about to open: 0 open PreparedStatements, 0 open ResultSets
[12/05/05 15:15:10:375 BST] 00000032 SQL           3   update PTF_PORTFOLIO set LOCK_NUM=?, NAME=?, DESCRIPTION=?, VOLUME=?, CLASS=?, CREATION_DT=?, PTT_FK=?, USR_FK=? where PTF_PK=? and LOCK_NUM=?
[12/05/05 15:15:10:375 BST] 00000032 SystemOut     O   Hibernate: update PTF_PORTFOLIO set LOCK_NUM=?, NAME=?, DESCRIPTION=?, VOLUME=?, CLASS=?, CREATION_DT=?, PTT_FK=?, USR_FK=? where PTF_PK=? and LOCK_NUM=?
[12/05/05 15:15:10:375 BST] 00000032 BatcherImpl   1   preparing statement
[12/05/05 15:15:10:375 BST] 00000032 EntityPersist 1   Dehydrating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:15:10:375 BST] 00000032 LongType      1   binding '4' to parameter: 1
[12/05/05 15:15:10:375 BST] 00000032 StringType    1   binding 'Test1' to parameter: 2
[12/05/05 15:15:10:375 BST] 00000032 StringType    1   binding 'THISSHOULDWORKGO2' to parameter: 3
[12/05/05 15:15:10:391 BST] 00000032 LongType      1   binding null to parameter: 4
[12/05/05 15:15:10:391 BST] 00000032 StringType    1   binding 'T' to parameter: 5
[12/05/05 15:15:10:391 BST] 00000032 TimestampType 1   binding '2005-05-11 11:10:13' to parameter: 6
[12/05/05 15:15:10:391 BST] 00000032 Cascades      1   id unsaved-value strategy NULL
[12/05/05 15:15:10:391 BST] 00000032 LongType      1   binding '1' to parameter: 7
[12/05/05 15:15:10:391 BST] 00000032 Cascades      1   id unsaved-value strategy NULL
[12/05/05 15:15:10:391 BST] 00000032 LongType      1   binding '1' to parameter: 8
[12/05/05 15:15:10:391 BST] 00000032 LongType      1   binding '24' to parameter: 9
[12/05/05 15:15:10:391 BST] 00000032 LongType      1   binding '3' to parameter: 10
[12/05/05 15:15:10:391 BST] 00000032 BatcherImpl   1   done closing: 0 open PreparedStatements, 0 open ResultSets
[12/05/05 15:15:10:391 BST] 00000032 BatcherImpl   1   closing statement
[12/05/05 15:15:10:391 BST] 00000032 SessionImpl   1   post flush
[12/05/05 15:15:10:391 BST] 00000032 SessionImpl   1   closing session
[12/05/05 15:15:10:391 BST] 00000032 SessionImpl   3   disconnecting session
[12/05/05 15:15:10:391 BST] 00000032 PortfolioDAO  I   Exiting:update
[12/05/05 15:15:10:438 BST] 00000032 PortfolioBean I   Exiting:updatePortfolio



Listing 4
Code:
[12/05/05 15:15:14:828 BST] 00000035 PortfolioBean I   Entering:updatePortfolio
[12/05/05 15:15:14:828 BST] 00000035 PortfolioDAO  I   Entering:update
[12/05/05 15:15:14:828 BST] 00000035 SessionImpl   3   opened session
[12/05/05 15:15:14:828 BST] 00000035 SessionImpl   1   updating [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:15:14:828 BST] 00000035 SessionImpl   1   flushing session
[12/05/05 15:15:14:828 BST] 00000035 SessionImpl   1   Flushing entities and processing referenced collections
[12/05/05 15:15:14:828 BST] 00000035 SessionImpl   1   Updating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:15:14:828 BST] 00000035 Versioning    1   Incrementing: 3 to 4
[12/05/05 15:15:14:828 BST] 00000035 SessionImpl   1   Processing unreferenced collections
[12/05/05 15:15:14:828 BST] 00000035 SessionImpl   1   Scheduling collection removes/(re)creates/updates
[12/05/05 15:15:14:828 BST] 00000035 SessionImpl   3   Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects
[12/05/05 15:15:14:828 BST] 00000035 SessionImpl   3   Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
[12/05/05 15:15:14:828 BST] 00000035 Printer       3   listing entities:
[12/05/05 15:15:14:828 BST] 00000035 Printer       3   com.abnamro.att.server.portfolios.domain.PtfPortfolio{volume=null, type=PortfolioType#1, owner=User#1, description=THISSHOULDFAILGo2, creationDate=2005-05-11 11:10:13, name=Test1, lockNum=3, id=24, pclass=T}
[12/05/05 15:15:14:828 BST] 00000035 SessionImpl   1   executing flush
[12/05/05 15:15:14:828 BST] 00000035 EntityPersist 1   Updating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:15:14:828 BST] 00000035 EntityPersist 1   Existing version: 3 -> New version: 4
[12/05/05 15:15:14:828 BST] 00000035 BatcherImpl   1   about to open: 0 open PreparedStatements, 0 open ResultSets
[12/05/05 15:15:14:828 BST] 00000035 SQL           3   update PTF_PORTFOLIO set LOCK_NUM=?, NAME=?, DESCRIPTION=?, VOLUME=?, CLASS=?, CREATION_DT=?, PTT_FK=?, USR_FK=? where PTF_PK=? and LOCK_NUM=?
[12/05/05 15:15:14:828 BST] 00000035 SystemOut     O   Hibernate: update PTF_PORTFOLIO set LOCK_NUM=?, NAME=?, DESCRIPTION=?, VOLUME=?, CLASS=?, CREATION_DT=?, PTT_FK=?, USR_FK=? where PTF_PK=? and LOCK_NUM=?
[12/05/05 15:15:14:828 BST] 00000035 BatcherImpl   1   preparing statement
[12/05/05 15:15:14:828 BST] 00000035 EntityPersist 1   Dehydrating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:15:14:828 BST] 00000035 LongType      1   binding '4' to parameter: 1
[12/05/05 15:15:14:828 BST] 00000035 StringType    1   binding 'Test1' to parameter: 2
[12/05/05 15:15:14:828 BST] 00000035 StringType    1   binding 'THISSHOULDFAILGo2' to parameter: 3
[12/05/05 15:15:14:844 BST] 00000035 LongType      1   binding null to parameter: 4
[12/05/05 15:15:14:844 BST] 00000035 StringType    1   binding 'T' to parameter: 5
[12/05/05 15:15:14:844 BST] 00000035 TimestampType 1   binding '2005-05-11 11:10:13' to parameter: 6
[12/05/05 15:15:14:844 BST] 00000035 Cascades      1   id unsaved-value strategy NULL
[12/05/05 15:15:14:844 BST] 00000035 LongType      1   binding '1' to parameter: 7
[12/05/05 15:15:14:844 BST] 00000035 Cascades      1   id unsaved-value strategy NULL
[12/05/05 15:15:14:844 BST] 00000035 LongType      1   binding '1' to parameter: 8
[12/05/05 15:15:14:844 BST] 00000035 LongType      1   binding '24' to parameter: 9
[12/05/05 15:15:14:844 BST] 00000035 LongType      1   binding '3' to parameter: 10
[12/05/05 15:15:14:844 BST] 00000035 StaleObjectSt W   An operation failed due to stale data
[12/05/05 15:15:14:891 BST] 00000035 StaleObjectSt W   TRAS0014I: The following exception was logged net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for com.abnamro.att.server.portfolios.domain.PtfPortfolio instance with identifier: 24
   at net.sf.hibernate.persister.AbstractEntityPersister.check(AbstractEntityPersister.java:513)
   at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:664)
   at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:621)
   at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52)
   at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449)
   at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435)
   at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2393)
   at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261)
   at com.abnamro.att.server.portfolios.dao.PortfolioDAO.update(Unknown Source)
   at com.abnamro.att.server.portfolios.ejb.PortfolioBean.updatePortfolio(Unknown Source)
   at com.abnamro.att.server.portfolios.interfaces.EJSRemoteStatelessPortfolio_40f61e87.updatePortfolio(Unknown Source)
   at com.abnamro.att.server.portfolios.interfaces._Portfolio_Stub.updatePortfolio(_Portfolio_Stub.java:303)
   at com.abnamro.att.ui.ejb.PortfolioHelper.updatePortfolio(Unknown Source)
   at com.abnamro.att.ui.action.AddEditPortfolio.onSubmit(Unknown Source)
   at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:248)
   at com.abnamro.att.ui.action.AddEditPortfolio.processFormSubmission(Unknown Source)
   at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:243)
   at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:128)
   at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:675)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:623)
   at org.springframework.web.servlet.FrameworkServlet.serviceWrapper(FrameworkServlet.java:384)
   at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:353)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
   at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1216)
   at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:630)
   at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:80)
   at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1752)
   at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:466)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:405)
   at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:104)
   at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:555)
   at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:608)
   at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:941)
   at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1028)
   at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1394)
.
                                 net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for com.abnamro.att.server.portfolios.domain.PtfPortfolio instance with identifier: 24
   at net.sf.hibernate.persister.AbstractEntityPersister.check(AbstractEntityPersister.java:513)
   at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:664)
   at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:621)
   at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52)
   at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449)
   at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435)
   at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2393)
   at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261)
   at com.abnamro.att.server.portfolios.dao.PortfolioDAO.update(Unknown Source)
   at com.abnamro.att.server.portfolios.ejb.PortfolioBean.updatePortfolio(Unknown Source)


Listing 5
Code:
[12/05/05 15:19:35:830 BST] 00000032 PortfolioBean I   Entering:updatePortfolio
[12/05/05 15:19:35:830 BST] 00000032 PortfolioDAO  I   Entering:update
[12/05/05 15:19:35:830 BST] 00000032 SessionImpl   3   opened session
[12/05/05 15:19:35:830 BST] 00000032 SessionImpl   1   updating [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:19:35:830 BST] 00000032 SessionImpl   1   flushing session
[12/05/05 15:19:35:830 BST] 00000032 SessionImpl   1   Flushing entities and processing referenced collections
[12/05/05 15:19:35:830 BST] 00000032 SessionImpl   1   Updating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:19:35:830 BST] 00000032 Versioning    1   Incrementing: 4 to 5
[12/05/05 15:19:35:830 BST] 00000032 SessionImpl   1   Processing unreferenced collections
[12/05/05 15:19:35:830 BST] 00000032 SessionImpl   1   Scheduling collection removes/(re)creates/updates
[12/05/05 15:19:35:830 BST] 00000032 SessionImpl   3   Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects
[12/05/05 15:19:35:830 BST] 00000032 SessionImpl   3   Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
[12/05/05 15:19:35:830 BST] 00000032 Printer       3   listing entities:
[12/05/05 15:19:35:846 BST] 00000032 Printer       3   com.abnamro.att.server.portfolios.domain.PtfPortfolio{volume=null, type=PortfolioType#1, owner=User#1, description=THISSHOULDWORKGO2, creationDate=2005-05-11 11:10:13, name=Test1, lockNum=4, id=24, pclass=T}
[12/05/05 15:19:35:846 BST] 00000032 SessionImpl   1   executing flush
[12/05/05 15:19:35:846 BST] 00000032 EntityPersist 1   Updating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:19:35:846 BST] 00000032 EntityPersist 1   Existing version: 4 -> New version: 5
[12/05/05 15:19:35:846 BST] 00000032 BatcherImpl   1   about to open: 0 open PreparedStatements, 0 open ResultSets
[12/05/05 15:19:35:846 BST] 00000032 SQL           3   update PTF_PORTFOLIO set LOCK_NUM=?, NAME=?, DESCRIPTION=?, VOLUME=?, CLASS=?, CREATION_DT=?, PTT_FK=?, USR_FK=? where PTF_PK=? and LOCK_NUM=?
[12/05/05 15:19:35:846 BST] 00000032 SystemOut     O   Hibernate: update PTF_PORTFOLIO set LOCK_NUM=?, NAME=?, DESCRIPTION=?, VOLUME=?, CLASS=?, CREATION_DT=?, PTT_FK=?, USR_FK=? where PTF_PK=? and LOCK_NUM=?
[12/05/05 15:19:35:846 BST] 00000032 BatcherImpl   1   preparing statement
[12/05/05 15:19:35:846 BST] 00000032 EntityPersist 1   Dehydrating entity: [com.abnamro.att.server.portfolios.domain.PtfPortfolio#24]
[12/05/05 15:19:35:846 BST] 00000032 LongType      1   binding '5' to parameter: 1
[12/05/05 15:19:35:846 BST] 00000032 StringType    1   binding 'Test1' to parameter: 2
[12/05/05 15:19:35:846 BST] 00000032 StringType    1   binding 'THISSHOULDWORKGO2' to parameter: 3
[12/05/05 15:19:35:846 BST] 00000032 LongType      1   binding null to parameter: 4
[12/05/05 15:19:35:846 BST] 00000032 StringType    1   binding 'T' to parameter: 5
[12/05/05 15:19:35:846 BST] 00000032 TimestampType 1   binding '2005-05-11 11:10:13' to parameter: 6
[12/05/05 15:19:35:846 BST] 00000032 Cascades      1   id unsaved-value strategy NULL
[12/05/05 15:19:35:846 BST] 00000032 LongType      1   binding '1' to parameter: 7
[12/05/05 15:19:35:846 BST] 00000032 Cascades      1   id unsaved-value strategy NULL
[12/05/05 15:19:35:846 BST] 00000032 LongType      1   binding '1' to parameter: 8
[12/05/05 15:19:35:846 BST] 00000032 LongType      1   binding '24' to parameter: 9
[12/05/05 15:19:35:846 BST] 00000032 LongType      1   binding '4' to parameter: 10
[12/05/05 15:19:35:846 BST] 00000032 BatcherImpl   1   done closing: 0 open PreparedStatements, 0 open ResultSets
[12/05/05 15:19:35:846 BST] 00000032 BatcherImpl   1   closing statement
[12/05/05 15:19:35:846 BST] 00000032 SessionImpl   1   post flush
[12/05/05 15:19:35:846 BST] 00000032 SessionImpl   1   closing session
[12/05/05 15:19:35:846 BST] 00000032 SessionImpl   3   disconnecting session
[12/05/05 15:19:35:846 BST] 00000032 PortfolioDAO  I   Exiting:update
[12/05/05 15:19:35:892 BST] 00000032 PortfolioBean I   Exiting:updatePortfolio



Top
 Profile  
 
 Post subject:
PostPosted: Fri May 13, 2005 6:12 am 
Beginner
Beginner

Joined: Thu Apr 21, 2005 12:15 pm
Posts: 34
Ok, Fixed my problem I think using get() to retrieve the row again and then overwriting the value again was the wrong way to do things.

I went back to by original code and just used update to reattched the detached instance and then write it. But the key was to add select-before-update="true" to the hb.xml file to force it to to reselect the record before updating to see if it is really dirty.

One question, can this property be modified at runtime for a aprticular session because it introduces a small overhead and I may not always need it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.