je travaille avec hibernate sous eclipse,j arrive à me connecter à oracle,
le fichier test.java d'insertion ds la base est le suivant:

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
package events;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;
 
import util.HibernateUtil;
import base.Pays;
public class Test {
public static void main(String[] args) throws HibernateException {
 
	Session session = HibernateUtil.currentSession();
 
	Transaction tx = session.beginTransaction();
 
	Pays pays = new Pays();
	pays.setNom("maroc");
	session.save(pays);
 
	pays = new Pays();
	pays.setNom("france");
 
	tx.commit();
 
	HibernateUtil.closeSession();
 
}}
lors de l execution j ai le msg d erreur suivant:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.ExceptionInInitializerError
	at events.Test.main(Test.java:11)
Caused by: java.lang.RuntimeException: Problème de configuration : /hibernate.cfg.xml not found
	at util.HibernateUtil.<clinit>(HibernateUtil.java:16)
	... 1 more
Caused by: org.hibernate.HibernateException: /hibernate.cfg.xml not found
	at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
	at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1324)
	at org.hibernate.cfg.Configuration.configure(Configuration.java:1346)
	at org.hibernate.cfg.Configuration.configure(Configuration.java:1333)
	at util.HibernateUtil.<clinit>(HibernateUtil.java:14)
	... 1 more
s il vous plait si quelqu'un à une idée a propos de cette erreur, qu 'il m'indique,
et merci d avance.

[ Modéré par SEMPERE Benjamin ]
Ajout des balises code
Les Règles du Forum