We have 2 tables in the database which represent animal and human patients. animal and human java objects extend patient interface
I have written the mapping files for these so we can save and get animal or patient from database.
However, I have a reciept object which needs a patient on it, which will need to be either human or animal object.
In the reciept table there is two columns one for human_id and one for animal_id
Is there a way in Hibernate mapping file so that it will create an animal and set into patient variable on receipt object if animal_id is populated or create human if human_id is populated?
|