slt,j'essai de faire une connexion Mysql/hibernate mai il y a une erreur qui s'affiche:
javax.naming.NameNotFoundException: Le Nom HibernateSessionFactory n'est pas lié à ce Contexte
slt,j'essai de faire une connexion Mysql/hibernate mai il y a une erreur qui s'affiche:
javax.naming.NameNotFoundException: Le Nom HibernateSessionFactory n'est pas lié à ce Contexte
aurrais tu fais une erreur de frappe en tappant une majuscule pour ta session factory
sinon un example de conf http://www.kodejava.org/examples/245.html
nn j'pense pas voici le code de l'hibernate.cfg.xml:
Code xml : 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 <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="connection.url">jdbc:mysql://localhost/base</property> <property name="connection.username">root</property> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property> <!-- thread is the short name for org.hibernate.context.ThreadLocalSessionContext and let Hibernate bind the session automatically to the thread --> <property name="current_session_context_class">thread</property><!-- this will show us all sql statements --> <property name="hibernate.show_sql">true</property> <mapping resource="com/yourcompany/hibernate/Hôtels.hbm.xml" /> <mapping resource="com/yourcompany/hibernate/Restaurants.hbm.xml" /> <mapping resource="com/yourcompany/hibernate/Hôpitaux.hbm.xml" /> </session-factory> </hibernate-configuration>
Tu n'as pas l'erreur complète ?
Ce n'est sans doute pas cela, mais tu dois renseigner le password de ta base de données dans ton fichier de config.
Ce code pose souvent un pb, ces jours ci
Manque tjs le mot de passe de la connexion même si l'exception n'a pas l'air d'être à cause de celà ..
Et aussi le localhost:3306
mai j"ai pa utisé un mot de passe
Partager