cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Loosing references to foreign objects -> update will fail
Date Wed, 20 Dec 2006 15:52:06 GMT


in our application we loose sometimes the reference to a mandatory foreign
object (not null, foreign key)

Our object relation are

Export Container -> products
product -> client
product -> image
product -> state

The problem occurs in our exporter process. It works like

   Begin Transaction
   Select all products that are in the correct state
   Create the export container
   export all product information including the image blob to file (read
   the objects into the memory)
   change the export container content
   for each product create the following state of the process (update of
   the product row and create a new state row)
   commit Transaction

During the commit some of the products have no reference to a client
object. => Update will fail because no mandatory object reference exist.
(org.objectstyle.cayenne.validation.ValidatiionException Product.client:
"client" is required.)
The database contains the correct client relation.
So it will run correct if we reduce the max. exported products to 100. But
for a other run with other data we exported 500 products per export run.

Also we have attached to the running process and so we see no memory
problem, because it occure if we have around 300 MB free memory in the jvm.

For a test run we also changed the implementation. So step 6 will also make
a commit for each product update :-(.
The result is that we can export the first 480 products, than we got the
error. Than we have additional product in the correct state to export. So
we will export in the example 180 and after 176 we got an additonal error.
Afterwards we export the last 4 without a problem.

So for us it seems that we loose during the processing the references of
some of out products. The corrupt products hat the persistent state 3
(Commited) and after the change state 4 (Modified). The persistent state
seems for us okay.

Our Environment:
      Windows XP
      Cayenne 1.2



View raw message