Liste null sur une association many-to-one
Bonjour,
Je développe une application web JEE. J'utilise hibernate.
J'ai une table Risk et une table RiskHistory. La table RiskHistory est mappée en many-to-one vers la table Risk. J'ai une liste de RiskHistory dans ma classe Risk.
Mon problème est que quand je veux me servir cette liste, elle est nulle. Savez vous d'où ça provient ?
Le mapping de RiskHistory :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.infotel.RMPTool.bean">
<class name="RiskHistory" table="riskhistory">
<id name="id" type="long">
<column name="id_risk_history" not-null="true" />
<generator class="identity" />
</id>
<property name="dateRecord" type="java.lang.String">
<column name="date_record" not-null="true" />
</property>
<property name="gravity" type="float">
<column name="gravity" not-null="true" />
</property>
<many-to-one name="ref_risk" column="ref_risk" class="Risk" lazy="false" />
</class>
</hibernate-mapping> |
Le mapping de Risk :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.infotel.RMPTool.bean">
<class name="Risk" table="risk">
<id name="id" type="long">
<column name="id_risk" not-null="true" />
<generator class="identity" />
</id>
...
<property name="status" type="java.lang.String">
<column name="status" not-null="true" />
</property>
<set name="refAction" table="actionhasrisk" lazy="false">
<key column="id_risk" />
<many-to-many column="id_action" class="Action" />
</set>
<many-to-one name="refType" column="ref_type" class="Type" lazy="false" />
<property name="idRefType" type="long" insert="false" update="false">
<column name="ref_type" />
</property>
<many-to-one name="refGroup" column="ref_group" class="Group" lazy="false" />
<property name="idRefGroup" type="long" insert="false" update="false">
<column name="ref_group" />
</property>
<property name="refOperation" type="long">
<column name="ref_operation" />
</property>
</class>
</hibernate-mapping> |
PS : Je n'utilise pas le Lasy loading.