Hibernate version:1.2.0.GA
Hi I'm mapping manually(Smart code wouldn't work with my old Oracle database)... and this is a mapping question.
I have chosen a "table per concrete class" strategy, to map to a List, as suggested in chapter 8 in the documentation.
So I have this List in a class -IntermediateTrack:
Code:
private List<IRailwayObject> m_RailwayObjects;
and I have 3 subobjects implementing my RailwayObject class. I have mapped and tested the subobject, they work fine. But how do I fill my list with random railway objects... I can't quiet capture the idea from the chapter. How do I use the
Code:
<any>
thing?
Do I have to map the base class -RailwayObject, even though it has no table?
I have three tables, which all have a Foreign key containing an ID from one other table. The foreign key column are named the same in all 3 tables -"IntermediateTrackId".
Mapping document for IntermediateTrack:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="BDK.TIB.ObjectModel" namespace="BDK.TIB.ObjectModel">
<class name="BDK.TIB.ObjectModel.IntermediateTrack, BDK.TIB.ObjectModel" table="INTERMEDIATETRACK" lazy="false">
<id name="ID" column="ID">
<generator class="sequence">
<param name="sequence">SEQTIB</param>
</generator>
</id>
<many-to-one name="DepartureSectionStation" class="BDK.TIB.ObjectModel.SectionStation, BDK.TIB.ObjectModel" column="DEPARTURESTATIONID" />
<many-to-one name="DestinationSectionStation" class="BDK.TIB.ObjectModel.SectionStation, BDK.TIB.ObjectModel" column="DESTINATIONSTATIONID" />
<set name="RailwayObjects">
<key column="INTERMEDIATETRACKID" />
<many-to-many class="BDK.TIB.ObjectModel.RailwayObject, BDK.TIB.ObjectModel" />
</set>
</class>
</hibernate-mapping>
I hope u don't mind -I didn't care to make question more general, by changing my objects to cats and mice :D
Hope you guys can help me?
Sorry about my english...