/** The time the row was last updated. */
@Version
@Column(insertable = true, updatable = true, unique = false, name = "UPDATE_TIME", nullable = true, columnDefinition = "timestamp")
protected Timestamp updateTime;")
protected Timestamp updateTime;[/font][/font]
---------------
In the following unit test our CREATE_TIME is set consistently by our framework code, however - the UPDATE_TIME requires four trips to the database and it is unique for each instance.
Question: How can we ensure that a consistent @Version timestamp is used for all instances within a unit of work?
---------------
*** Begin Transaction ***; thread=http-8080-1; method=persistNonCascadedCreateUpdate
[EL Fine]: 2012-02-22 11:35:43.041--ClientSession(1801630204)--Connection(887781807)--Thread(Thread[http-8080-1,5,main])--SELECT CURRENT_TIMESTAMP()
[EL Fine]: 2012-02-22 11:35:43.042--ClientSession(1801630204)--Connection(887781807)--Thread(Thread[http-8080-1,5,main])--INSERT INTO ADDRESS (UUID_KEY, ADDRESS_LINE1_TXT, ADDRESS_LINE2_TXT, ADDRESS_LINE3_TXT, CITY_NM, COUNTRY_CD, CREATE_TIME, CREATE_USER, STATE_CD, UPDATE_TIME, UPDATE_USER, ZIP_CD) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[EL Fine]: 2012-02-22 11:35:43.042--ClientSession(1801630204)--Connection(887781807)--Thread(Thread[http-8080-1,5,main])-- bind => [[B@62864c36, ABC1, null, null, XYZ1, USA, 2012-02-22 11:35:43.037, NotificationBFIT, CA, 2012-02-22 11:35:43.041, NotificationBFIT, 94111]
[EL Fine]: 2012-02-22 11:35:43.043--ClientSession(1801630204)--Connection(887781807)--Thread(Thread[http-8080-1,5,main])--SELECT CURRENT_TIMESTAMP()
[EL Fine]: 2012-02-22 11:35:43.044--ClientSession(1801630204)--Connection(887781807)--Thread(Thread[http-8080-1,5,main])--INSERT INTO DEBT_TYPE (UUID_KEY, DEBT_TYPE_CD, CREATE_TIME, CREATE_USER, DEBT_TYPE_DESC, DEBT_TYPE_PRIORITY_CD, UPDATE_TIME, UPDATE_USER) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
[EL Fine]: 2012-02-22 11:35:43.045--ClientSession(1801630204)--Connection(887781807)--Thread(Thread[http-8080-1,5,main])-- bind => [[B@5ef59fc2, 01, 2012-02-22 11:35:43.037, NotificationBFIT, null, 1, 2012-02-22 11:35:43.041, NotificationBFIT]
[EL Fine]: 2012-02-22 11:35:43.045--ClientSession(1801630204)--Connection(887781807)--Thread(Thread[http-8080-1,5,main])--SELECT CURRENT_TIMESTAMP()
[EL Fine]: 2012-02-22 11:35:43.046--ClientSession(1801630204)--Connection(887781807)--Thread(Thread[http-8080-1,5,main])--INSERT INTO DEBT (UUID_KEY, DEBT_AGENCY_ACCT_ID, CREATE_TIME, CREATE_USER, DEBT_CURRENT_BALANCE_AMT, DEBT_DELINQUENCY_TS, DEBT_STAT_CD, UPDATE_TIME, UPDATE_USER, CR_AGENCY_SITE_UUID_KEY_FK, DEBT_TYPE_UUID_KEY_FK) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[EL Fine]: 2012-02-22 11:35:43.047--ClientSession(1801630204)--Connection(887781807)--Thread(Thread[http-8080-1,5,main])-- bind => [[B@4fcbaa42, DebtA, 2012-02-22 11:35:43.037, NotificationBFIT, 200.00, 2007-05-23 01:01:01.999, , 2012-02-22 11:35:43.041, NotificationBFIT, [B@5c571db0, [B@5ef59fc2]
[EL Fine]: 2012-02-22 11:35:43.049--ClientSession(1801630204)--Connection(887781807)--Thread(Thread[http-8080-1,5,main])--SELECT CURRENT_TIMESTAMP()
[EL Fine]: 2012-02-22 11:35:43.049--ClientSession(1801630204)--Connection(887781807)--Thread(Thread[http-8080-1,5,main])--INSERT INTO DEBTOR (UUID_KEY, CREATE_TIME, CREATE_USER, DEBTOR_FIRST_NM, DEBTOR_LAST_NM, DEBTOR_STAT_CD, DEBTOR_TIN_NR, DEBTOR_TYPE_CD, DEBTOR_CONTROL_NM, UPDATE_TIME, UPDATE_USER, DEBT_UUID_KEY_FK, ADDRESS_UUID_KEY_FK) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[EL Fine]: 2012-02-22 11:35:43.05--ClientSession(1801630204)--Connection(887781807)--Thread(Thread[http-8080-1,5,main])-- bind => [[B@d1e0abe, 2012-02-22 11:35:43.037, NotificationBFIT, null, Lee, , 111222333, I, null, 2012-02-22 11:35:43.041, NotificationBFIT, [B@4fcbaa42, [B@62864c36]
*** Commit [create=2012-02-22 11:35:43.037]; milliseconds = 14; instances=4; thread=http-8080-1; user id=NotificationBFIT
Marvin Toll
CTO, Pattern Enabled Development
http://PatternEnabled.com
|