当前位置: 代码迷 >> Java Web开发 >> myeclipse2013 为何搭建不了 hibernate 4 整天报错 我已依照书本做 求简单例 ...
  详细解决方案

myeclipse2013 为何搭建不了 hibernate 4 整天报错 我已依照书本做 求简单例 ...

热度:677   发布时间:2013-08-22 23:26:20.0
myeclipse2013 为何搭建不了 hibernate 4 整天报错 我已依照书本做 求简单例子
求解一个 myeclipse2013 搭建 hibernater
简单例子
希望有图解
搜索更多相关主题的帖子: hibernate  

----------------解决方案--------------------------------------------------------
什么错误?
----------------解决方案--------------------------------------------------------
回复 2楼 yuccn
2013-8-23 20:22:50 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
2013-8-23 20:22:50 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.4.Final}
2013-8-23 20:22:50 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
2013-8-23 20:22:50 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
2013-8-23 20:22:50 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
2013-8-23 20:22:50 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
2013-8-23 20:22:50 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: orm/Userinfo.hbm.xml
2013-8-23 20:22:50 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
2013-8-23 20:22:50 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
2013-8-23 20:22:50 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
2013-8-23 20:22:50 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
2013-8-23 20:22:50 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] at URL [jdbc:sqlserver://localhost:1433;DatabaseName=struts2]
2013-8-23 20:22:50 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=sa, password=****}
2013-8-23 20:22:51 org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.SQLServerDialect
2013-8-23 20:22:51 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
2013-8-23 20:22:51 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
2013-8-23 20:22:51 org.hibernate.validator.util.Version <clinit>
信息: Hibernate Validator bean-validator-3.0-JBoss-4.0.2
2013-8-23 20:22:51 org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA
信息: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
2013-8-23 20:22:51 org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA
信息: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
%%%% Error Creating SessionFactory %%%%
org.hibernate.MappingException: Could not instantiate id generator [entity-name=orm.Userinfo]
    at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:123)
    at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:192)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:317)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1744)
    at db.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:34)
    at orm.BaseHibernateDAO.getSession(BaseHibernateDAO.java:14)
    at db.Check.main(Check.java:18)
Caused by: org.hibernate.MappingException: org.hibernate.dialect.SQLServerDialect does not support sequences
    at org.hibernate.dialect.Dialect.getSequenceNextValString(Dialect.java:791)
    at org.hibernate.id.SequenceGenerator.configure(SequenceGenerator.java:111)
    at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:117)
    ... 6 more
2013-8-23 20:22:51 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
2013-8-23 20:22:51 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
2013-8-23 20:22:51 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: orm/Userinfo.hbm.xml
2013-8-23 20:22:51 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
2013-8-23 20:22:51 org.hibernate.cfg.Configuration$MappingsImpl addImport
INFO: HHH000071: Duplicate import: orm.Userinfo -> orm.Userinfo
2013-8-23 20:22:51 org.hibernate.cfg.Configuration$MappingsImpl addImport
INFO: HHH000071: Duplicate import: orm.Userinfo -> Userinfo
%%%% Error Creating SessionFactory %%%%
org.hibernate.InvalidMappingException: Could not parse mapping document from resource orm/Userinfo.hbm.xml
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3409)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXmlQueue(Configuration.java:3398)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3386)
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1341)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1731)
    at db.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:73)
    at db.HibernateSessionFactory.getSession(HibernateSessionFactory.java:55)
    at orm.BaseHibernateDAO.getSession(BaseHibernateDAO.java:14)
    at db.Check.main(Check.java:18)
Caused by: org.hibernate.DuplicateMappingException: Duplicate class/entity mapping orm.Userinfo
    at org.hibernate.cfg.Configuration$MappingsImpl.addClass(Configuration.java:2574)
    at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:172)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3406)
    ... 8 more
Exception in thread "main" java.lang.NullPointerException
    at db.Check.main(Check.java:18)
----------------解决方案--------------------------------------------------------
  相关解决方案