my dog learned polymorphism*
The moose likes Object Relational Mapping and the fly likes JDO issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JDO issue" Watch "JDO issue" New topic
Author

JDO issue

Arun Raja S.K
Greenhorn

Joined: May 30, 2011
Posts: 8
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 ?.
 
 
subject: JDO issue