-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: how to solve a possible multiple inheritance problem
PostPosted: Wed Dec 29, 2004 12:33 am 
Newbie

Joined: Tue Mar 16, 2004 11:41 am
Posts: 6
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.