Problème hibernate exécution
Bonjour, je suis entrain de suivre le tutorial suivant : http://www.laliluna.de/first-hiberna...torial-fr.html, je l'ai réalisé sans problème mais enfin lorsque je fais le test rien n'affecte ma base de donnée et il me dit :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| %%%% Error Creating HibernateSessionFactory %%%%
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:1411)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1433)
at de.laliluna.hibernate.InitSessionFactory.initSessionFactory(InitSessionFactory.java:65)
at de.laliluna.hibernate.InitSessionFactory.getInstance(InitSessionFactory.java:38)
at de.laliluna.example.TestClient.createHoney(TestClient.java:80)
at de.laliluna.example.TestClient.main(TestClient.java:33)
Exception in thread "main" org.hibernate.HibernateException: Could not initialize the Hibernate configuration
at de.laliluna.hibernate.InitSessionFactory.initSessionFactory(InitSessionFactory.java:82)
at de.laliluna.hibernate.InitSessionFactory.getInstance(InitSessionFactory.java:38)
at de.laliluna.example.TestClient.createHoney(TestClient.java:80)
at de.laliluna.example.TestClient.main(TestClient.java:33)
09:03:36,906 INFO Environment:514 - Hibernate 3.2.6
09:03:36,921 INFO Environment:547 - hibernate.properties not found
09:03:36,953 INFO Environment:681 - Bytecode provider name : cglib
09:03:36,968 INFO Environment:598 - using JDK 1.4 java.sql.Timestamp handling
09:03:37,156 INFO Configuration:1432 - configuring from resource: /hibernate.cfg.xml
09:03:37,156 INFO Configuration:1409 - Configuration resource: /hibernate.cfg.xml |
Pourriez vous m'aider ?
Problème hibernate exécution
ok, merci pour la réponse, voila d'abord l'arborescence de mon projet : Pièce jointe 25931, j'ai une question a vous poser mes chers amis, dans des tutos je trouve que je dois mettre les fichier de configuration dans mon projet directement et parfois ils me demandent de le mettre dans le dossier webinf/src, a votre avis ou dois je le mettre ? pour mon fichier de configuration, le voila :
Code:
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
| <?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:mysql://localhost/firsthibernate
</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 name="hibernate.connection.pool_size"></property -->
<!-- dialect for MySQL -->
<property name="dialect">
net.sf.hibernate.dialect.MySQLDialect
</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.transaction.factory_class">
net.sf.hibernate.transaction.JTATransactionFactory
</property>
<property name="jta.UserTransaction">
java:comp/UserTransaction
</property>
<mapping resource="Honey.hbm" />
</session-factory>
</hibernate-configuration> |
une autre question, normalement je travaille avec les librairies d'hibernate 3, est ce que j'ai le droit de mettre : hibernate-configuration-3.0.dtd au lieu de hibernate-configuration-2.0.dtd, ou c'est fait automatiquement ! merci pour votre intêret ! 8O
Problème hibernate exécution
mais d'ou le problème que j'ai a propos de l'exécution ?
Problème hibernate exécution
Donc la solution est de le placer sous le dossier src ? et comment je corrigede problème de version ?