I must be doing something really wrong, because when I write code that
I THINK should generate an update statement, an insert statement is
generated instead. I am trying to use optimistic locking. I recalled
that there was a bug that involved optimistic locking and updates, so
I downloaded and built the most recent code from the CVS, and
still the wrong queries are generated.
This is the code that I think should cause an update :
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
broker.beginTransaction();
AccountInterface acc = retrieveAccountByNumber("1234");
acc.setTelephoneNumber("555-5555");
broker.store(acc);
broker.commitTransaction();
This is what is actually generated (from spy.log)
1058821254048|201|27|statement|SELECT
accountID,isDisconnected,serviceType,deleteTag,customerID,deleteTagSetDate,t
elephoneNumber,accountNumber,rowVersion,billingCycle FROM Account WHERE
accountID = ? |SELECT
accountID,isDisconnected,serviceType,deleteTag,customerID,deleteTagSetDate,t
elephoneNumber,accountNumber,rowVersion,billingCycle FROM Account WHERE
accountID = '5'
1058821254658|781|21|statement|INSERT INTO Account
(accountID,rowVersion,accountNumber,deleteTag,deleteTagSetDate,isDisconnecte
d,telephoneNumber,serviceType,billingCycle,customerID) VALUES
(?,?,?,?,?,?,?,?,?,?) |INSERT INTO Account
(accountID,rowVersion,accountNumber,deleteTag,deleteTagSetDate,isDisconnecte
d,telephoneNumber,serviceType,billingCycle,customerID) VALUES
('1','0','1234','false','','','555-5555','','','0')
1058821254678|0|21|rollback||
Since the record alreayd exists, an exception is thrown and the transaction
rolls back.
Is my code completely wrong? I thought I had understood the tutorial.
Thanks,
Bonnie MacKellar
software engineer
Mobius Management Systems, Inc.
[EMAIL PROTECTED]