Bonjour,
Voila je débute avec hibernate et j'ai le soucis suivant :
Voici aussi mon fichier de conf hibernate
<?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/test</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">admin</property>
<!-- 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="Caisse.hbm.xml" />
</session-factory>
</hibernate-configuration>
Voici ma fichier Caisse.hbm.xml :
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<class name="com.minosis.hibernate.Caisse" table="caisse">
<property
column="montantC"
length="22"
name="MontantC"
not-null="true"
type="java.lang.Double"
/>
<property
column="Statut"
length="20"
name="Statut"
not-null="true"
type="string"
/>
<property
column="Id_Pers"
name="IdPers"
not-null="true"
type="string"
/>
<property
column="montantO"
length="22"
name="MontantO"
not-null="true"
type="java.lang.Double"
/>
</class>
</hibernate-mapping>
Et voici les erreurs affichées :
24-janv.-2008 11:52:06 net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.1.6
24-janv.-2008 11:52:06 net.sf.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
24-janv.-2008 11:52:06 net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
24-janv.-2008 11:52:06 net.sf.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
24-janv.-2008 11:52:06 net.sf.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
24-janv.-2008 11:52:06 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: Caisse.hbm.xml
Exception in thread "main" java.lang.ExceptionInInitializerError
at tools.Welcome.build(Welcome.java:57)
at tools.Welcome.<init>(Welcome.java:41)
at PointOfSale.main(PointOfSale.java:29)
Caused by: java.lang.RuntimeException: Exception building SessionFactory: Resource: Caisse.hbm.xml not found
at com.minosis.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:19)
... 3 more
Caused by: net.sf.hibernate.MappingException: Resource: Caisse.hbm.xml not found
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:334)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1013)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:969)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:883)
at com.minosis.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:16)
... 3 more
J'ai deja essayé de mettre le nom du package dans le hibernate mapping mais cela ne fonctionne pas non plus
Si vous avez une idée, merci d'avance
Partager