Bonjour,
voici ma base de donnée, j'aimerai avoir le mapping xml correspondant :
J'utilise hibernate 3.1
J'ai essayé ceci mais ca ne marche pas :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 create table adherent ( adh_id SERIAL not null, grp_id INT4 null, adh_nom VARCHAR(100) null, adh_prenom VARCHAR(100) null, constraint PK_ADHERENT primary key (adh_id) ); create table groupe ( grp_id SERIAL not null, grp_lib VARCHAR(50) null, constraint PK_GROUPE primary key (grp_id) ); alter table adherent add constraint FK_ADHERENT_REFERENCE_GROUPE foreign key (grp_id) references groupe (grp_id) on delete restrict on update restrict;
Il y a surement quelque chose que je ne fais pas correctement. Merci d votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 <?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="bean"> <class name="adherent" table="adherent" node="texte"> <id name="adh_id" node="adh_id"/> <property name="adh_nom" node="adh_nom"/> <property name="adh_prenom" node="adh_prenom"/> <set name="groupe" cascade="all"> <key column="grp_id" /> <one-to-many class="groupe" /> </set> </class> <class name="groupe"> <id name="grp_id" node="grp_id"/> <property name="grp_lib" node="grp_lib"/> </class> </hibernate-mapping>
Pour info je veux à partir d'un ficheir xml alimenter plusieurs tables de la base de donnée.
Partager