Quote:
What do you mean by "evict"?
suppose I have an Applicant class that has a one-to-many association to Education class. Let's say education set is not lazy.
Applicant {
...
Set education;
...
}
I retrieve an Applicant and send it over to the web tier. Web tier creates an Education record and sends it back to the business tier for save.
Code:
addEducation (Applicant a, Education e) {
-- open new session
-- lock applicant record
if (a.getEducation ().size () >= 2) {
trhow exception (too many education recs)
} else {
a.getEducation ().add (e);
}
s.saveOrUpdate(a);
}
as you can imagine the code above will be problematic if database is accessed from multiple applications (and in my case it is). So while web tier was adding education record some administartor might add education record and my business rule will fail (the one that says no more than two records allowed). Hence was my question what do I do to evict not the whole applicant record but just a collection it is associated with?
[/quote]