Salut a vous tous
je debute le developpement sous eclipse avec Hibernate et j'ai rencontrer un probleme d'execution de mon programme
voici l'erreur qu'il me donne:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 Exception in thread "main" java.lang.ExceptionInInitializerError at Test.main(Test.java:24) Caused by: java.lang.ClassCastException: org.hibernate.transaction.JDBCTransactionFactory at net.sf.hibernate.transaction.TransactionFactoryFactory.buildTransactionFactory(TransactionFactoryFactory.java:34) at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:66) at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1155) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:789) at com.minosis.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:13) ... 1 more
voici le code de mon fichier hibernate.cfg.xml
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" encoding="utf-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory > <!-- local connection properties --> <property name="hibernate.connection.url">jdbc:mysql://localhost/hibernate</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password"></property> <!-- property name="hibernate.connection.pool_size"></property --> <!-- dialect for MySQL --> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hibernate.show_sql">false</property> <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property> </session-factory> </hibernate-configuration>
et le code de employer.hbm.xml
si vous pouvez bien m'aider car j'ai vraiment besoin de ce programme
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 <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > <hibernate-mapping package="com.minosis.hibernate"> <class name="Employer" table="employer" > <property name="Id" column="id" type="string" not-null="true" length="5" /> <property name="Nom" column="nom" type="string" not-null="true" length="50" /> <property name="Prenom" column="prenom" type="string" not-null="true" length="50" /> </class> </hibernate-mapping>
P.S j'ai suivie tous les etapes de presque tous les cours sur le net j'ai rassembler tous les .jar necessaire
Partager