七月 26, :17 上午 org.mon.reflection.java.JavaReflectionManager &clinit&INFO: HCANN000001: Hibernate Commons Annotations {4.0.4.Final}七月 26, :17 上午 org.hibernate.Version logVersionINFO: HHH000412: Hibernate Core {4.3.0.Final}七月 26, :17 上午 org.hibernate.cfg.Environment &clinit&INFO: HHH000206: hibernate.properties not found七月 26, :17 上午 org.hibernate.cfg.Environment buildBytecodeProviderINFO: HHH000021: Bytecode provider name : javassist七月 26, :17 上午 org.hibernate.cfg.Configuration configureINFO: HHH000043: Configuring from resource: /hibernate.cfg.xml七月 26, :17 上午 org.hibernate.cfg.Configuration getConfigurationInputStreamINFO: HHH000040: Configuration resource: /hibernate.cfg.xml七月 26, :17 上午 org.hibernate.internal.util.xml.DTDEntityResolver resolveEntityWARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!七月 26, :18 上午 org.hibernate.cfg.Configuration addResourceINFO: HHH000221: Reading mappings from resource: com/hrr/entity/Grade.hbm.xml七月 26, :18 上午 org.hibernate.cfg.Configuration addResourceINFO: HHH000221: Reading mappings from resource: com/hrr/entity/Student.hbm.xml七月 26, :18 上午 org.hibernate.cfg.Configuration doConfigureINFO: HHH000041: Configured SessionFactory: null七月 26, :18 上午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configureINFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)七月 26, :18 上午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://127.0.0.1:3306/hrr]七月 26, :18 上午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH000046: Connection properties: {user=root, password=****}七月 26, :18 上午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH000006: Autocommit mode: false七月 26, :18 上午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configureINFO: HHH000115: Hibernate connection pool size: 20 (min=1)七月 26, :18 上午 org.hibernate.dialect.Dialect &init&INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect七月 26, :18 上午 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateServiceINFO: HHH000399: Using default transaction strategy (direct JDBC transactions)七月 26, :18 上午 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory &init&INFO: HHH000397: Using ASTQueryTranslatorFactoryException in thread "main" java.lang.ExceptionInInitializerError at com.hrr.entity.Test.addStudent(Test.java:21) at com.hrr.entity.Test.main(Test.java:10)Caused by: org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:185) at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135) at org.hibernate.internal.SessionFactoryImpl.&init&(SessionFactoryImpl.java:399) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857) at com.hrr.util.HibernateUtil.&clinit&(HibernateUtil.java:18) ... 2 moreCaused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer] at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:138) at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:188) at org.hibernate.tuple.entity.EntityMetamodel.&init&(EntityMetamodel.java:403) at org.hibernate.persister.entity.AbstractEntityPersister.&init&(AbstractEntityPersister.java:520) at org.hibernate.persister.entity.SingleTableEntityPersister.&init&(SingleTableEntityPersister.java:148) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163) ... 6 moreCaused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:135) ... 15 moreCaused by: org.hibernate.PropertyNotFoundException: Could not find a getter for grade in class com.hrr.entity.Student at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:310) at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:304) at org.hibernate.mapping.Property.getGetter(Property.java:323) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:411) at org.hibernate.tuple.entity.AbstractEntityTuplizer.&init&(AbstractEntityTuplizer.java:200) at org.hibernate.tuple.entity.PojoEntityTuplizer.&init&(PojoEntityTuplizer.java:80) ... 20 more
爱生活,爱燕茹!
你用Hibernate访问数据库的时候有没有注意和实体的属性对应,你这个问题我没找到你写的代码的重点,抱歉,但我估计是这个问题。
你还没有登录,请先登录或注册慕课网帐号
66161人关注
Copyright (C)
All Rights Reserved | 京ICP备 号-2