Hello,

I have observed the following:
when I do the following:   

broker.beginTransaction();
broker.delete(x);
broker.store(x, ObjectModificationDefaultImpl.UPDATE);

this fails with a 
org.apache.ojb.broker.KeyConstraintViolatedException

When I use optimistic locking, this fails with
an
 
org.apache.ojb.broker.OptimisticLockException: 
Object has been modified by someone else

I dislike the error message.  Rather than changing the
exception text, I propose the introduce another 
exception "ObjectAlreadyDeletedException" or the like.

This can easily be implemented using the
Collection field "markedForDelete" in 
PersistenceBrokerImpl.  Besides, this collection
should be a HashSet rather than an array list.

What do you think?  May I do it?

Should the ObjectAlreadyDeletedException extend
KeyConstraintViolatedException (to preserve at least
some compatibility)?

Alternatively (or additionally), one could introduce
a method  
  PersistenceBroker.isDeleted(Object obj)
and implement that method using
  markedForDelete.contains(obj)


Olli

-- 
  Oliver Matz
  ppi Media GmbH
  Deliusstraße 10
  D-24114 Kiel
  phone +49 (0) 43 1-53 53-422
  fax           +49 (0) 43 1-53 53-2 22
  email mailto:[EMAIL PROTECTED]
  web   www.ppi.de

Explore your printnet!

DRUPA 2004
Düsseldorf, Germany, 6 - 19 May 2004, Booth 6E62

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to