0
<?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="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="hibernate.connection.url">jdbc:hsqldb:hsql://localhost</property>
<property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
<property name="hibernate.hbm2ddl.auto">create-drop</property>
<mapping resource="User.hbm.xml"/>
</session-factory>
</hibernate-configuration>
映射文件是沒有得到在SessionFactory
異常加載hibernate.cfg.xml文件加載映射文件時碰到的問題在線程 「主要」 org.hibernate.MappingException:未知 實體:com.test.dto.User
,但如果我添加映射manua lly在Configuration
實例中:
static {
Configuration config = new Configuration().configure().addResource("User.hbm.xml");
ServiceRegistry registry = new StandardServiceRegistryBuilder().applySettings(config.getProperties()).build();
sessionFactory = config.buildSessionFactory(registry);
}
映射工作正常......,有什麼建議?
工作正常! :D – DGomez
@DGomez我很高興:) –