当前位置: 代码迷 >> Java Web开发 >> hibernate的一个有关问题弄了2天了
  详细解决方案

hibernate的一个有关问题弄了2天了

热度:98   发布时间:2016-04-17 16:39:04.0
hibernate的一个问题弄了2天了
19:25:52,593     INFO   Environment:   Hibernate   3.1.3

19:25:52,656     INFO   Environment:   loaded   properties   from   resource   hibernate.properties:   {hibernate.connection.driver_class=com.mysql.jdbc.Driver,   hibernate.cglib.use_reflection_optimizer=true,   hibernate.dialect=org.hibernate.dialect.MySQLDialect,   hibernate.jdbc.batch_size=0,   hibernate.connection.username=root,   hibernate.connection.url=jdbc:mysql://localhost:3306/user,   hibernate.show_sql=true,   hibernate.connection.password=****,   hibernate.connection.pool_size=10}

19:25:52,687     INFO   Environment:   using   CGLIB   reflection   optimizer

19:25:52,687     INFO   Environment:   using   JDK   1.4   java.sql.Timestamp   handling

19:25:53,046     INFO   Configuration:   configuring   from   resource:   /hibernate.cfg.xml

19:25:53,046     INFO   Configuration:   Configuration   resource:   /hibernate.cfg.xml

19:25:53,218     INFO   Configuration:   Reading   mappings   from   resource:   com/iustice/User.hbm.xml

19:25:53,281   ERROR   XMLHelper:   Error   parsing   XML:   XML   InputStream(7)   The   content   of   element   type   "id "   must   match   "(meta*,column*,type?,generator?) ".

19:25:53,296   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?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*) ".

19:25:53,359   ERROR   HibernateUtil:   Initial   SessionFactory   creation   failed.

org.hibernate.MappingException:   Could   not   read   mappings   from   resource:   com/iustice/User.hbm.xml



StandardWrapperValve[action]:   Servlet.service()   for   servlet   action   threw   exception

java.lang.ExceptionInInitializerError

java.lang.ExceptionInInitializerError

at   com.HibernateUtil. <clinit> (HibernateUtil.java:16)

at   com.iustice.user.LoginAction.execute(LoginAction.java:26)


Caused   by:   org.hibernate.MappingException:   Could   not   read   mappings   from   resource:   com/iustice/User.hbm.xml

at   org.hibernate.cfg.Configuration.addResource(Configuration.java:485)

Caused   by:   org.xml.sax.SAXParseException:   The   content   of   element   type   "id "   must   match   "(meta*,column*,type?,generator?) ".

这些是提示


<?xml   version= '1.0 '   encoding= 'UTF-8 '?>
<!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 ">
  相关解决方案