faire pareil pour l'autre tables (adresse)
Adresse(
Adr_Id, designation, codepostal,ville)
mais pour la table
PersonAdress(Pers_Id, Adr_Id)
apercu des 4 fichiers
fichier PersonAdress.hbm.xml
<hibernate-mapping>
<class name="Projet.PersonAdress" table="personadress">
<composite-id>
<key-property name="Pers_Id" column="Pers_Id"/>
<key-property name="Adr_Id" column="Adr_Id"/>
</composite-id>
</class>
<!-- This is a named query that we will use later -->
<query name="all.personadress">From PersonAdress</query>
</hibernate-mapping>
fichier , PersonAdress.java
package Projet;
import java.io.*;
public class PersonAdress
implements Serializable{
private int Pers_Id;
private int Adr_Id;
/*** accsseurs***/
}
je n'ai pas implémenté equals() et hashCode() bien que celàà fut conseillé pour certain cas de figure
voir paragraphe 5.1.5 composite-Id
(
http://www.hibernate.org/hib_docs/v3/re ... pping.html)
fichier data-management-config.xml
ajouter la balise destination
<destination id="personadress.hibernate">
<adapter ref="java-dao" />
<properties>
<use-transactions>true</use-transactions>
<source>flex.data.assemblers.HibernateAssembler</source>
<scope>application</scope>
<metadata>
<!--This is the identifier from the hibernate-entity bean -->
<identity>Pers_Id</identity>
<identity>Adr_Id</identity>
</metadata>
<network>
<session-timeout>20</session-timeout>
<paging enabled="false" pageSize="10" />
<throttle-inbound policy="ERROR" max-frequency="500"/>
<throttle-outbound policy="REPLACE" max-frequency="500"/>
</network>
<server>
<hibernate-entity>Projet.PersonAdress</hibernate-entity>
<fill-method>
<name>fill</name>
<params>java.util.List</params>
</fill-method>
<fill-configuration>
<use-query-cache>false</use-query-cache>
<allow-hql-queries>true</allow-hql-queries>
</fill-configuration>
</server>
</properties>
</destination>
le fichier PersonAdress.as
package Projet
{
[Managed]
[RemoteClass(alias="Projet.PersonAdress")]
public class PersonAdress
{
public function PersonAdress()
{
}
private Pers_Id:int;
private Adr_Id:int;
}
}
les modification majeurs sont mise en gras dans les deux fichiers correspondant par l'extension
Comparer Peronnes.hbm.xml et PersonAdress.hbm.xml
comparer les deux balises destination dans data-management-config.xml etc ...