org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]

使用Hibernate 插入List数据时出现了以下异常:

 1 SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8]
 2 SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
 3 log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
 4 log4j:WARN Please initialize the log4j system properly.
 5 log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
 6 org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
 7     at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:110)
 8     at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:135)
 9     at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:80)
10     at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:323)
11
12     at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:456)
13     at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:131)
14     at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)
15     at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:267)
16     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
17     at com.bdqn.entity.test.Test.setPics(Test.java:315)
18     at com.bdqn.entity.test.Test.setPhones(Test.java:341)
19     at com.bdqn.entity.test.Test.main(Test.java:67)
20 Caused by: java.lang.reflect.InvocationTargetException
21     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
22     at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
23     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
24     at java.lang.reflect.Constructor.newInstance(Unknown Source)
25     at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:107)
26     ... 11 more
27 Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for phones in class com.bdqn.entity.User
28     at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:306)
29     at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:299)
30     at org.hibernate.mapping.Property.getGetter(Property.java:294)
31     at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:300)
32     at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:141)
33     at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:78)
34     ... 16 more

根据异常信息中的提示:Could not find a getter for phones in class com.bdqn.entity.User

原因:发现是由于实体类中,使用的属性方法的get和set方法名方法名称的问题!属性为phones,而方法是setPhone(),getPhone(),get和set之后的单词与属性不一致

解决方法:删除原先的set和get方法,重新生成即可!

时间: 2024-10-09 06:02:50

org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]的相关文章

使用hibernate时出现 org.hibernate.HibernateException: Unable to get the default Bean Validation factory

hibernate 在使用junit测试报错: org.hibernate.HibernateException: Unable to get the default Bean Validation factory at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:127) at org.hibernate.cfg.Configuration.appl

hibernate 错误:org.hibernate.HibernateException: Unable to get the default Bean Validation factory

最近在自学Hibernate与Struts2进行集成时,出现了一个错误,错误截图如下: 错误代码如下: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for

Caused by:org.hibernate.HibernateException:Unable to make JDBC Connection

1.错误描述 Caused by:org.hibernate.HibernateException:Unable to make JDBC Connection[jdbc\:mysql\://localhost\:3306/school] 2.错误原因 在hibernate.cfg.xml中配置数据库路径时 <property name="connection.url"> jdbc\:mysql://localhost\:3306/school </property&

org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge]

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [beans4.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: could not ins

org.hibernate.tuple.entity.PojoEntityTuplizer 错误解决办法

org.hibernate.tuple.entity.PojoEntityTuplizer 不能instace 之前做了一个项目遇到的.出现这个问题的可能会有很多: 首先应该考虑是不是jar出现冲突. 我遇到的问题是实体类的hibernate映射文件有问题嘞,所有出现这个问题. 解决办法: 检查实体类的hibernate映射文件的异常情况

Caused by: org.hibernate.InvalidMappingException: Unable to read XML

1.错误描述 2015-09-20 23:37:41 [main] WARN org.springframework.context.support.GenericApplicationContext - Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error cre

配置ssh框架启动tomcat服务器报异常Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

在Spring中配置jdbc时,引用的是dbcp.jar包,在db.properties配置文件中,使用了之前的properties配置文件的用户名username(MySql用户名) 然后在启动服务器报了如下几个异常: 1.org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [a

Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when &#39;hibernate.dialect&#39; not set

java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125) at org.springframework.test.context.suppo

Hibernate - HHH000352: Unable to release batch statement

这是hibernate的一个bug,具体看https://hibernate.atlassian.net/browse/HHH-11732?attachmentViewMode=list When using stateless session with jdbc batch size we get an HHH000352: Unable to release batch statement.. error in session.close() after rollback: Code:Con