| 
					
						 Hi, I am trying to use optimistic locking with timestamp. I followed example from the book and I could not get that work. I don't see the StaleObjectStateException been thrown.
 
 I have this in mapping file:
 
 <timestamp
             column="LAST_MODIFIED_DATE"  
             name="lastModifiedDate"
 />
 
 and this maps a column of database table, LAST_MODIFIED_DATE, which the type is Date (Oracle 9i). 
 
 In POJO code, I have:
    
    private Date lastModifiedDate;  
    
    public Date getLastModifiedDate() {
         return lastModifiedDate;
     }    
    
    public void setLastModifiedDate(Date lastModifiedDate) {
         this.lastModifiedDate = lastModifiedDate;
     }
 
 Then from my Web app, I have two browsers up running in two PCs. I update the same object in the following order:
 1) user1 get BBB
 2) user2 get BBB
 3) user1 update BBB
 4) user2 update BBB
 
 From console, I see:
  
 update TBL_BBB set LAST_MODIFIED_DATE=?, EMAIL=? where PK_BBB_ID=? and LAST_MODIFIED_DATE=?
 
 The database gets updated and reflect the user2's input. I did not get any exception.
 
 ANything wrong here?
 
 Thanks,
 
 J 
					
  
						
					 |