1

I create an object on wich the server has a unique constraint defined on one field.

But when I want to update the object previously fetched, I get a "UniqueFieldValueConstraintViolationException" without the possibility to commit the object.

What is the right way to persist the changes made on an object that have a unique constraint on it ?

thanks in advance.

taharqa
  • 1,112
  • 1
  • 13
  • 19

1 Answers1

0

Looks like your object is disconnected from the db context. The object has to be associated to an open db4o container, otherwise it's seen as a new object. If you have no choice but to work

German
  • 10,263
  • 4
  • 40
  • 56
  • Hi German, I first think like you, so I try the same sample with an associated opene db4o container then retry : but result is the same. So I think, this is "a feature" and that I have to rethink "and update" like "a delete"+ "a store". This is very strange that we can not update another fields in the object ... – taharqa Dec 01 '11 at 20:21
  • @taharqa: Make sure you don't close/reopen the object container between retrieval and storage of the same object. – Paŭlo Ebermann Dec 02 '11 at 17:20