• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDO issue

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?.
 
Eat that pie! EAT IT! Now read this tiny ad. READ IT!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic