Hi,
I'm new to Nhibernate and I have a question about mapping files.
I have a simple database in Mysql 5 with these innoDB tables.
City(id, name)
Trip(id, orig_city, dest_city)
Both orig_city and dest_city are foreign keys to the City table
If I want to use collections for the bags, what should I do?
Do I have to do this:
city.hbm.xml
Code:
<bag name="TripList1" inverse="true" lazy="true" >
<key column="orig_city" />
<one-to-many class="Trip" />
</bag>
<bag name="TripList2" inverse="true" lazy="true" >
<key column="dest_city" />
<one-to-many class="Trip" />
</bag>
trip.hbm.xml
Code:
<many-to-one name="OrigCity" column="orig_city" class="City" />
<many-to-one name="DestCity" column="dest_city" class="City" />
and then do everything twice in the city.cs (members, property, add )?
Thanks,