Quote:
you guys with duplicate rows - how do you update/delete one row and not the others ? How do you distinguish these rows ?
Seeing that you are part of the Hibernate theam, you probably know how <bag> is implemented better than me :-)
I'll tell a bit of my scenario when it is needed:
I am importing (with Hibernate) a lot of sales transaction logs for a national
transport company. Some of these transactions can be identical (same ticket, same destination etc).
During import a series of chekcs and relation identification are done. If the transaction passes, the data is copied to a
'domain' object with proper object relations that is persisted by Hibernate and used by the rest of the system.
My 'domain' naturally has syntethic keys and relations, but the data I'm importing definitively has not.
So when i'm importing these data I'm basically traversing a <bag> with 'import' objects, copying them to
'domain' objects and persisting them. Hibernate then gives the domain objects an identity
from a DB sequence.
As for the need of identifying which element I would like to delete in a bag, the answer is I don't care which one I
delete as long as the number of identical rows decreases by one :-)
As I stated in a previous post I can probably solve this by using a <bag> with composite-elements.