Bonjour,

Je suis sur ce problème depuis 2 jours, j'ai l'impression d'avoir chercher partout. Je ne suis pas du genre à demander de l'aide sur un forum mais là je suis à la limite de jeter mon ordi par terre

Je suis sous hibernate2 j'ai utlisé le tuto suivant : http://defaut.developpez.com/tutorie...pse/hibernate/
(Vous allez dire utilise hibernate3 mais j'ai un souci aussi que je pige encore moins alors je suis revenue à hibernate2)

Maintenant j'aimerais faire une requête SQL comme ceci:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
Session session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();
 
Query q = session.createSQLQuery("SELECT * FROM ECOLE where id_ecole='1'", "listEcole", Ecole.class);
System.out.println(q.list());
tx.commit();
HibernateUtil.closeSession();
Et il me sort cette erreur :
org.postgresql.util.PSQLException: Le nom de colonne id_ecole0_ n'a pas été trouvé dans ce ResultSet.

D'ou vient ce 0_ qu'il rajoute? je commence hibernate et je pense comprendre à peu près comment ça marche mais là je suis perdue!

Si ça peut aider mes fichier xml:

fichier de configuration
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
 
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
 
<hibernate-configuration>
	<session-factory>
		<!-- local connection properties -->
		<property name="hibernate.connection.url">
			jdbc:postgresql://127.0.0.1/postgres
		</property>
		<property name="hibernate.connection.driver_class">
			org.postgresql.Driver
		</property>
		<property name="hibernate.connection.username">postgres</property>
		<property name="hibernate.connection.password">contacto</property>
		<!-- property name="hibernate.connection.pool_size"></property -->
		<!-- dialect for PostgreSQL -->
		<property name="dialect">
			net.sf.hibernate.dialect.PostgreSQLDialect
		</property>
		<property name="hibernate.show_sql">true</property>
		<property name="hibernate.use_outer_join">true</property>
		<property name="hibernate.transaction.factory_class">
			net.sf.hibernate.transaction.JDBCTransactionFactory
		</property>
		<property name="jta.UserTransaction">
			java:comp/UserTransaction
		</property>
		<mapping resource="UtiNews.hbm" />
		<mapping resource="Ecole.hbm" />
		<mapping resource="News.hbm" />
		<mapping resource="UtiEtu.hbm" />
		<mapping resource="Contexte.hbm" />
		<mapping resource="Contact.hbm" />
		<mapping resource="UtiExp.hbm" />
		<mapping resource="Experience.hbm" />
		<mapping resource="Societe.hbm" />
		<mapping resource="Utilisateur.hbm" />
		<mapping resource="ContactTemp.hbm" />
		<mapping resource="Etude.hbm" />
	</session-factory>
</hibernate-configuration>
fichier de mapping de Ecole :
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
 
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
	"-//Hibernate/Hibernate Mapping DTD//EN"
	"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
 
<hibernate-mapping package="com.hibernate">
	<class name="Ecole" table="ecole">
		<id
			column="id_ecole"
			name="IdEcole"
			type="integer"
		>
			<generator class="vm" />
		</id>
		<property
			column="pays"
			length="150"
			name="Pays"
			not-null="true"
			type="string"
		 />
		<property
			column="ville"
			length="150"
			name="Ville"
			not-null="true"
			type="string"
		 />
		<set inverse="true" name="EtudeSet">
			<key column="fk_ecole" />
			<one-to-many class="Etude" />
		</set>
	</class>
</hibernate-mapping>
Merci d'avance