The content of element type "session-factory" must match "(property*,mapping*,(c

ljhjay 2010-03-28 09:42:17
下面是我的hibernat.cfg.xml 不知哪里错了 myeclipse 老是提示错误

<!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">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="hibernate.connection.url">
jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=spring_hibernate2;SelectMethod=cursor;
</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>


<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.hbm2ddl.auto">update</property>

<property name="cache.use_second_level_cache">true</property>
<class-cache class="domain.Person" usage="read-write"/>
<property name="cache.provider_class">org.hibernate.cache.OSCacheProvider</property>


<mapping resource="domain/Person.hbm.xml" />
<mapping resource="domain/Department.hbm.xml" />
<mapping resource="domain/Employee.hbm.xml" />
<mapping resource="domain/IdCard.hbm.xml" />
<mapping resource="domain/Citizen.hbm.xml" />
<mapping resource="domain/Student.hbm.xml" />
<mapping resource="domain/Teacher.hbm.xml" />
</session-factory>
</hibernate-configuration>
...全文
676 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
binghongcoffee 2010-04-19
  • 打赏
  • 举报
回复
session factory 和 second level cache 生命周一期是一样的,所以你把那个calss cache 放到mapping resource后面,应该可以了
injuer 2010-03-29
  • 打赏
  • 举报
回复
<class-cache class="domain.Person" usage="read-write"/>

写在MAPPING后面

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧