Hi there,
I'm working under Hibernate 3.1.3, in a Java 5 EE Application
I have an entity called REFERENCE and one called PASSAGE_POINT. A Reference has one or more PassagePoint. The PassagePoint for a given Reference are sorted according to the delayAfterDeparture (DELAY_AFTER_DEPARTURE) member in PassagePoint.
Here is my two mapping files.
Reference.hbm.xml:
Code:
<hibernate-mapping default-cascade="none">
<class name="com.thalys.opalys.domain.ReferenceImpl" table="REFERENCE" dynamic-insert="false" dynamic-update="false">
<id name="id" type="java.lang.Long" unsaved-value="null">
<column name="ID" sql-type="BIGINT"/>
<generator class="native">
</generator>
</id>
<property name="startTime" >
<column name="START_TIME" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
<type name="org.joda.time.contrib.hibernate.PersistentLocalTimeAsString">
</type>
</property>
<property name="displayName" >
<column name="DISPLAY_NAME" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
<type name="java.lang.String">
</type>
</property>
<many-to-one name="axis" class="com.thalys.opalys.domain.AxisImpl" cascade="none" foreign-key="REFERENCE_AXIS_FKC" lazy="proxy" fetch="select">
<column name="AXIS_FK" not-null="true" sql-type="BIGINT"/>
</many-to-one>
<set name="passagePoints" order-by="DELAY_AFTER_DEPARTURE" lazy="false" fetch="select" inverse="true" cascade="delete">
<key foreign-key="PASSAGE_POINT_REFERENCE_FKC">
<column name="REFERENCE_FK" sql-type="BIGINT"/>
</key>
<one-to-many class="com.thalys.opalys.domain.PassagePointImpl"/>
</set>
<set name="variantes" order-by="REFERENCE_FK" lazy="false" fetch="select" inverse="true" cascade="delete">
<key foreign-key="VARIANTE_REFERENCE_FKC">
<column name="REFERENCE_FK" sql-type="BIGINT"/>
</key>
<one-to-many class="com.thalys.opalys.domain.VarianteImpl"/>
</set>
</class>
</hibernate-mapping>
PassagePoint.hbm.xml:
Code:
<hibernate-mapping default-cascade="none">
<class name="com.thalys.opalys.domain.PassagePointImpl" table="PASSAGE_POINT" dynamic-insert="false" dynamic-update="false">
<id name="id" type="java.lang.Long" unsaved-value="null">
<column name="ID" sql-type="BIGINT"/>
<generator class="native">
</generator>
</id>
<property name="delayAfterDeparture" >
<column name="DELAY_AFTER_DEPARTURE" not-null="true" unique="false" sql-type="INTEGER"/>
<type name="int">
</type>
</property>
<property name="distanceOnClassicLines" >
<column name="DISTANCE_ON_CLASSIC_LINES" not-null="true" unique="false" sql-type="DOUBLE"/>
<type name="double">
</type>
</property>
<property name="distanceOnHighSpeedLines" >
<column name="DISTANCE_ON_HIGH_SPEED_LINES" not-null="true" unique="false" sql-type="DOUBLE"/>
<type name="double">
</type>
</property>
<many-to-one name="previousPoint" class="com.thalys.opalys.domain.PassagePointImpl" foreign-key="PASSAGE_POINT_PREVIOUS_POINT_C" cascade="delete" lazy="proxy" fetch="select">
<column name="PREVIOUS_POINT_FK" not-null="false" sql-type="BIGINT" unique="true"/>
</many-to-one>
<one-to-one name="nextPoint" class="com.thalys.opalys.domain.PassagePointImpl" property-ref="previousPoint" cascade="none" lazy="proxy" fetch="select"/>
<many-to-one name="reference" class="com.thalys.opalys.domain.ReferenceImpl" cascade="none" foreign-key="PASSAGE_POINT_REFERENCE_FKC" lazy="proxy" fetch="select">
<column name="REFERENCE_FK" not-null="true" sql-type="BIGINT"/>
</many-to-one>
<many-to-one name="point" class="com.thalys.opalys.domain.ParticularPointImpl" cascade="none" foreign-key="PASSAGE_POINT_POINT_FKC" lazy="proxy" fetch="select">
<column name="POINT_FK" not-null="true" sql-type="BIGINT"/>
</many-to-one>
</class>
</hibernate-mapping>
This is an AndroMDA auto-generated code. And this usually works fine, passage point were retrieved in the right order. But i might have changed something, and now in some cases its not working anymore. They are retrieved in the opposite order....
This is a weird thing and i can't understand it.
Thanks in advance...
[/code]