`
deejay
  • 浏览: 145328 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

IllegalArgumentException

    博客分类:
  • ssh2
阅读更多

错误信息:

Caused by: org.hibernate.HibernateException: org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of umbrella.pojo.EntertainmentPOJO.id
 at umbrella.tyrant.dao.DAOTemplate$16.doInHibernate(DAOTemplate.java:512)
 at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
 ... 137 more
Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of umbrella.pojo.EntertainmentPOJO.id
 at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:195)
 at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:206)
 at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3619)
 at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3335)
 at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:204)
 at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:241)
 at org.hibernate.type.ManyToOneType.disassemble(ManyToOneType.java:186)
 at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:101)
 at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2208)
 at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2159)
 at org.hibernate.loader.Loader.list(Loader.java:2117)
 at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
 at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596)
 at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
 at umbrella.tyrant.dao.DAOTemplate$16.doInHibernate(DAOTemplate.java:508)
 ... 138 more
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:169)
 ... 152 more

 

配制文件:

 

<many-to-one name="entertainmentSort" class="umbrella.pojo.EntertainmentSortPOJO"  cascade="all" fetch="join">
            <column name="entertainment_sort_id" not-null="true">
                <comment>娱乐分类ID</comment>
            </column>
        </many-to-one>

 

解决方法:将fetch属性去掉,默认为select.则问题解决。

为什么会出现这种情况呢?

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics