Dear All!
I'm new to Hibernate tools, so please be patient.
I am trying to generate POJO classes and mapping files (*.hbm.xml) from JDBC connection (from my DB scheme), but I'm not able to generate uni-directional association between two object.
In my DB, I have two tables, with two ID column, which are primary keys. No foreign key is specified in my DB. I set the foreign key link explicitly in hibernate.reveng.xml, that is:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
<hibernate-reverse-engineering>
<table-filter match-catalog="myCat" match-schema="dbo"
match-name="airplane" package="my.package"/>
<table-filter match-catalog="myCat" match-schema="dbo"
match-name="airplane_online" package="my.package"/>
<table catalog="myCat" schema="dbo" name="airplane_online" class="AirplaneOnlineBase"/>
<table catalog="myCat" schema="dbo" name="airplane" class="AirplaneBase">
<column name="ID"/>
<foreign-key constraint-name="AIRPLANE_AIRPLANE_ONLINE" foreign-table = "Airplane_online">
<column-ref local-column="ID" foreign-column="ID"/>
<one-to-one property="AirplaneOnline" />
</foreign-key>
</table>
</hibernate-reverse-engineering>
When I generate my POJO classes, I got a reference in both classes (as it's bi-rectional), but I would like to have it uni-directional. I don't have mapping files (I generate them too) where i could set the mapping to be uni-directional.
Also, am I missing something, but a single foreign-key should result in uni-directional association, shouldn't it?
Thanks for all the help in advance,
gmate