cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Lepine" <>
Subject Delete query not generating as expected
Date Sat, 07 Apr 2007 17:59:05 GMT
I'm experiencing something confusing when committing changes with a
DataContext and objects to be deleted. I have a list of CayenneDataObjects
that I'm either updating or deleting depending on parameters set in a web
client. I've included the code below.

When I debug the code, I can see the PersistanceState of the objects.
Initially, the PersistanceState is COMMITTED. After the for loop, the
objects that did have a delete flag set, do have a PersistanceState of
DELETED (as expected). So, when the DataContext.commitChanges() method
executes, it only generates and runs the update query. It does not generate
the delete query as I'd expect it to. After the commitChanges() executes,
the objects that had a PersistanceState of DELETED now have a
PersistanceState of TRANSIENT, and obviously, the records still exist in the

Does anyone have any ideas that I could try? This is driving me crazy. I'm
sure I'm missing something very simple.

Thanks for any help you can offer.

// MerchElementSupportedAnswer is a subclass of CayenneDataObject
*for* (MerchElementSupportedAnswer answer : answers) {

    // if data for answer was deleted, delete record

*    if* (answer.isDeleteFlag()) {


*        continue*;






  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message