Hi all,
I have a legacy schema with two tables which I am trying to map to a single class using <join> construct. The data is read-only, but I would like to insert some test data during development. The FK references are not maintained during inserts; please help.
Hibernate version: 3.2.6.ga
Mapping documents:
Code:
<class name="Person" table="PERSON">
<id name="id" column="PERSON_ID">...</id>
<join table="ADDRESS">
<key column="ADDRESS_ID"/>
<property name="address"/>
...
</join>
...
</class>
Code between sessionFactory.openSession() and session.close():Code:
txn = session.beginTransaction();
Person p = new Person();
p.setAddress("Test Address");
session.save(p);
txn.commit();
Name and version of the database you are using:HSQL 1.8.0.7
The generated SQL (show_sql=true):Code:
Hibernate: insert into person (id) values (null)
Hibernate: call identity()
Hibernate: insert into address (address, address_id) values (?, ?)