Hello,
Im quiet new to hibernate but read everything i found on this topic without success. I actually found different possibilities but would like to know which would be correct in my case.
I have a table A and a table B. Bot have the fields shipref and traffictype. It's a composite id.
Now i have my Detail.hbm.xml which is mapping this 2 fields for a 1:1 join.
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Nov 2, 2006 2:24:54 PM by Hibernate Tools 3.2.0.beta8 -->
<hibernate-mapping>
<class name="Shipment">
<id name="id" column="shipref">
<generator class="native" />
</id>
<many-to-one name="shipmentgeo" column="shipref" unique="true"
not-null="true" />
</class>
<class name="Shipmentgeo">
<id name="id" column="shipref">
<generator class="native" />
</id>
<one-to-one name="shipment" property-ref="shipmentgeo" />
</class>
</hibernate-mapping>
I already wrote the POJO's for those two tables. How can i now set in a bean those shipref, traffictype fields and after just do a getDetailInformation(), where i get fields from both tables?