当前位置: 代码迷 >> Java Web开发 >> 一个新手关于hibernate 的有关问题 id" must match 郁闷啊
  详细解决方案

一个新手关于hibernate 的有关问题 id" must match 郁闷啊

热度:359   发布时间:2016-04-17 16:39:57.0
一个新手关于hibernate 的问题 id" must match 郁闷啊!!
10:34:20,187     INFO   Configuration:   Reading   mappings   from   resource:   com/iustice/User.hbm.xml

10:34:20,250   ERROR   XMLHelper:   Error   parsing   XML:   XML   InputStream(7)   The   content   of   element   type   "id "   must   match   "(meta*,column*,type?,generator?) ".

10:34:20,250   ERROR   XMLHelper:   Error   parsing   XML:   XML   InputStream(10)   The   content   of   element   type   "class "   must   match   "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natu


<?xml   version= "1.0 "?>
<!DOCTYPE   hibernate-mapping   PUBLIC
"-//Hibernate/Hibernate   Mapping   DTD   3.0//EN "
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd ">
<hibernate-mapping   package= "com.iustice ">
<class   name= "User "   table= "user ">
<id   name= "id "   column= "id ">
  <generator   class= "identity "> </generator>
</id>
<property   name= "username "   column= "username "     unique= "true "/>
<property   name= "password "   column= "password "   />
</class>
</hibernate-mapping>


<?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 ">

<!--   Generated   by   MyEclipse   Hibernate   Tools.                                       -->
<hibernate-configuration>

<session-factory>
<property   name= "connection.url "> jdbc:mysql://localhost/user </property>
<property   name= "connection.driver_class "> org.gjt.mm.mysql.Driver </property>
<property   name= "connection.username "> root </property>
<property   name= "connection.password "> 002312708 </property>

<property   name= "dialect "> org.hibernate.dialect.MySQLDialect </property>
<property   name= "connection.pool_size "> 10 </property>
<property   name= "current_session_context_class "> thread </property>
<property   name= "cache.provider_class "> org.hibernate.cache.NoCacheProvider </property>
<property   name= "show_sql "> true </property>
<!--
<property   name= "hbm2ddl.auto "> create </property>
-->
<mapping   resource= "com/iustice/User.hbm.xml "   />


</session-factory>

</hibernate-configuration>


ublic   class   User   implements   Serializable   {
        private   long   id;
  相关解决方案