Hi again, how to map this kind of domain model:
Code:
class Person
{
private String name;
private String surname;
private Children children;
}
class Children extends AbstractSet<Child> implements Set<Child>
{
private Set<Child> underlyingSet = new HashSet<Child>();
public Child giveBirth()
{
underlyingSet.add(new Child());
}
public boolean add(Child child)
{
throw new UnsupportedOperationException("Use giveBirth()");
}
[...]
}
The main problem here is that Person-Child is an 1-N association, however non-standard collection container is used, so proxy won't fit. How to map this not breaking the model by addition of some "special" setters/getters and stuff like this. I would like to keep "transparent persistency" as much as possible...
Anybody?
Thanks in advance!
rafi