ola,
Est - il possible de générer mes fichiers de mappings .hbm à l'aide du plugin Hibernate Tools? Si oui, pouvez vous me l'indiquez? dois je passer obligatoirement par un fichier build.xml avec ANT?

Je me connecte à une base de données MySQL5...
Cela ne me dérange pas de faire des modifs des fichiers hbm... Cela me semblait probable.
Voici un exemple de mon fichier de configuration hibernate.

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
<hibernate-configuration>
 
    <session-factory name="CallCenterSessionFactory">
	    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.password">mysqladmin</property>
        <property name="hibernate.connection.url">jdbc:mysql://opensourceserv:3306/db_callcenter</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.default_catalog">db_callcenter</property>
        <property name="hibernate.default_schema">db_callcenter</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
		<property name="hibernate.show_sql">true</property>
 
 
 
    </session-factory>
 
</hibernate-configuration>
Ma classe Adresse:

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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
public class Adresse {
 
	private String adresse1;
 
	private String adresse2;
 
	private String cp;
 
	private String ville;
 
	private Pays pays;
 
	public Adresse(String adresse1, String adresse2, String cp, String ville,
			Pays pays) throws Exception {
		super();
		this.setAdresse1(adresse1);
		this.setAdresse2(adresse2);
		this.setCp(cp);
		this.setPays(pays);
		this.setVille(ville);
	}
 
	public String getAdresse1() {
		return adresse1;
	}
 
	public void setAdresse1(String adresse1) {
		this.adresse1 = adresse1;
	}
 
	public String getAdresse2() {
		return adresse2;
	}
 
	public void setAdresse2(String adresse2) {
		this.adresse2 = adresse2;
	}
 
	public String getCp() {
		return cp;
	}
 
	public void setCp(String cp) throws Exception {
		if (!cp.matches("((0[1-9])|([1-9][0-9]))[0-9]{3}+")) {
			throw new Exception("Le format du code postal n'est pas valide");
		}
		this.cp = cp;
	}
 
	public Pays getPays() {
		return pays;
	}
 
	public void setPays(Pays pays) {
		this.pays = pays;
	}
 
	public String getVille() {
		return ville;
	}
 
	public void setVille(String ville) throws Exception {
		if (!ville.matches("[^0-9]*")) {
			throw new Exception("Le format de la ville n'est pas valide");
		}
		this.ville = ville;
	}
 
	public void affiche(){
		System.out.println("\nAdresse 1 : "+this.getAdresse1()+"\nAdresse 2 : "+this.getAdresse2()+"\nCode postal : "+this.getCp()+"\nVille : "+this.getVille()+"\nPays : "+this.getPays().getLibelle());
	}
 
 
} // end Adresse

Merci
Yoko