Hibernate version:
3.0.5
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
Oracle 9.2.0.6.0
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
I am having trouble creating the correct mapping documents for the following legacy tables:
Code:
(parent)
CREATE TABLE doctors
(
id numeric(10) NOT NULL,
name varchar(30),
CONSTRAINT doctors_pk PRIMARY KEY (id)
)
(parent)
CREATE TABLE patients
(
id numeric(10) NOT NULL,
name varchar(30),
CONSTRAINT patients_pk PRIMARY KEY (id)
)
(children)
CREATE TABLE addresses
(
id numeric(10) NOT NULL, <-- either the doctors.id or patients.id
seq numeric(5) NOT NULL, <-- keeps track of the address sequence
addr_type varchar(1) NOT NULL, <-- 'D' denotes doctor address, 'P' patients
address_1 varchar(25),
address_2 varchar(25),
city varchar(25),
state_code varchar(2),
CONSTRAINT addresses_pk PRIMARY KEY (id, seq, addr_type)
)
I would like to be able to call doctors.getAddresses() and return a Set of Addresses associated with the doctor. Same with the patients. I have googled, read the documentation, searched the forum and can't seems to but it together.
Any help is appreciated