Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Data loss challenge

Hi,

 we have the following construct


Shelf has Books 1 to many

To add an book to the shelf we do  (in pseudo code)

shelf.getBooks().add(newBook);
persist(shelf);

However, we see that when another user also adds an book for the same shelf around the same time that the previous book is completely removed from the db.

We suspect that the second user already has done the shelf.getBooks() and now adds the new book to an old list and thereby letting Eclipselink think that the already existing book is no longer on the shelf? 

Does this sound like a common mistake? What is the pattern to avoid this?

Thanks,

Wim Jongman

Back to the top