Hibernate 冬眠持久性
我得到这个错误: GRAVE:无法从文件配置数据存储 hibernate.cgf.xml:Hibernate 冬眠持久性,hibernate,Hibernate,我得到这个错误: GRAVE:无法从文件配置数据存储 hibernate.cgf.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourc
<?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 name="">
<property name="hibernate.connection.driver_class">com.jdbc.mysql.driver</property>
<property name="hibernate.connection.password">manel</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/pfe</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">update</property>
<property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>
<mapping resource="org/domain/projet/config/Employe.hbm.xml"/>
<mapping class="org.domain.projet.config.Employe" file="Employe" package="org.domain.projet.config"/>
<event type="save-update"/>
</session-factory>
</hibernate-configuration>
com.jdbc.mysql.driver
曼内尔
jdbc:mysql://localhost:3306/pfe
根
org.hibernate.dialogue.mysqldialogue
1.
线
org.hibernate.cache.NoCacheProvider
更新
真的
更新
org.hibernate.transaction.JTATransactionFactory
java:comp/UserTransaction
net.sf.hibernate.transaction.JDBCTransactionFactory
Employe.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 package="org.domain.projet.config">
<class name="Employe" table="employe" lazy="false">
<id
column="id"
name="Id"
type="integer"
>
<generator class="vm" />
</id>
<property
column="prenom"
length="45"
name="Prenom"
not-null="true"
type="string"
/>
<property
column="mail"
length="45"
name="Mail"
not-null="true"
type="string"
/>
<property
column="adresse"
length="45"
name="Adresse"
not-null="true"
type="string"
/>
<property
column="tel"
length="10"
name="Tel"
not-null="true"
type="integer"
/>
<property
column="service"
length="45"
name="Service"
not-null="true"
type="string"
/>
<property
column="fonction"
length="45"
name="Fonction"
not-null="true"
type="string"
/>
<property
column="login"
length="45"
name="Login"
not-null="true"
type="string"
/>
<property
column="password"
length="45"
name="Password"
not-null="true"
type="string"
/>
<property
column="matricule"
length="45"
name="Matricule"
not-null="true"
type="string"
/>
<property
column="nom"
length="45"
name="Nom"
not-null="true"
type="string"
/>
</class>
</hibernate-mapping>
有解决方案吗?配置看起来不正确。您正在定义2个事务工厂(可能还有其他错误)
org.hibernate.transaction.JTATransactionFactory
net.sf.hibernate.transaction.JDBCTransactionFactory
我建议您向google咨询配置文件的示例并阅读文档。谢谢,但这是唯一的错误,它就是找不到名为“Employe”的实体类信息:hibernate.properties未找到信息:从文件配置:hibernate.cfg.xml信息:映射资源:org/domain/projet/config/Employe.hbm.xml信息:映射类:org.domain.projet.config.Employe->Employe信息:配置的会话工厂:信息:映射文件:。\Employe.hbm.xml:无法从文件配置数据存储:.\Employe.hbm.xml java.io.FileNotFoundException:。\Employe.hbm.xml(Le fichier spécifiéest introvable)java.io.FileNotFoundException:。\Employe.hbm.xml(Le fichier spécifiéest introvable)
<property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>