hello,
this is not a bug report. i have a high-level question/problem that i'd like opinions on, if possible.
A. hypothetical situation:
1. i have an object named Patient
2. Patient has a field "insuredPerson" whose value is of type "InsuredPerson"
3. both Patient and InsuredPerson happen to subclass "Person"
one of the properties of "Person" is SSN (assume of type String)
which is unique
> an InsuredPerson may be a patient, but does not have to be.
> a Patient may be an InsuredPerson, but does not have to be.
B. how can i:
1. create a patient named bob, with ssn: 123456789
2. create an insuredperson representation of bob (i.e. bob happens to be employed and has medical insurance)
3. associate bob (the insuredperson) as the insured person for bob (the patient). that is: bobPatient.setInsuredPerson(bobInsuredPerson);
C. as far as i can tell:
1. the two objects cannot be distinct objects because the ssn's uniqueness will not allow that
2. the two objects cannot have the same identity in hibernate and so cannot be the same either
thank you in advance for any thoughts on this problem. i'm sure i'm missing something fundamental or have overlooked something in the hibernate documentation. i have read the manual and have also read the book but it's been a while.
sincerely,
eitan
Hibernate version:
2.1.6 (patched for jira entry 474)
Mapping documents:
n/a
Code between sessionFactory.openSession() and session.close():
n/a
Full stack trace of any exception that occurs:
n/a
Name and version of the database you are using:
postgresql v7.4
The generated SQL (show_sql=true):
n/a
Debug level Hibernate log excerpt:
n/a
|