Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDO issue

 
Arun Raja S.K
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am working on a project and would be grateful if i get a solution. The issue is , i try to perform a delete a row first and next insert a row operation in a table (update is complex here so performing delete and insert ). The table has two constraints, one is primary key constraint and other is unique key constraint (which is a combination of 4 columns). here primary key is a number sequence which automatically increases by 1 whenever a insert happens.

Unique constraint exception is thrown when i try to delete a row and insert a row which has different value in primaryid column and has same values in all other 4 columns as deleted row.

why this exception occurs even though i try to delete the row first and then try to insert new row in table ?

From java side, I first use deletePersistentAll() method to delete the rows and setColumnName() methods to insert values for each columns and then i call makepersistent() method to persist the objects. All this JDO method calls happens as part of Transaction
and Unique constraint exception is thrown when executing commit and transaction is rolled back.

what change i should do to avoid this exception from occuring ?.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic