WrongClassExceptionObject:id为22的对象不是指定的子类,仅用于新条目.old条目正常工作 [英] WrongClassExceptionObject:object with id:22 was not of the specified subclass ,only for new entries.old entries are working fine

查看:946
本文介绍了WrongClassExceptionObject:id为22的对象不是指定的子类,仅用于新条目.old条目正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用Ejb,Spring + hibernates。
我的应用程序从数据库中提取一行,并根据其鉴别器列值(entry1,entry2,entry3 ...)连接到标记在我的tablename.hbm.xml文件和代码中的JavaClass文件

我所有的旧代码工作正常,
我添加了一个new.java文件,当我尝试添加一个新条目到 tablename.hbm.xml 文件我正面临以下错误。


org。 springframework.orm.hibernate.HibernateobjectRetrivalFailureException:具有id:22的
对象不是指定的子类:(与table1相关的类的路径)(Discriminator:entry1)
嵌套的异常是net.sf.hibernate.WrongClassException :id为22的对象不是指定的子类:(table1相关类的路径)(Discriminator:entry1)

没有重复在我的表中没有任何空间问题。
我的新实例都没有被执行。这是由于我的.hbm.xml文件没有每次刷新。请让我知道任何建议。

解决方案

简单地说,添加到以下项目文件属性:

  spring.jpa.properties。 

I an using Ejb,Spring+hibernates in my application. My application fetches a row from DB and based on its discriminator column value(entry1,entry2,entry3...) it connects to the JavaClass file which is marked in the tag of my tablename.hbm.xml file and code gets executed.

All my old code is working fine, I have added a new.java file ,and when i tried to add a new entry to the tablename.hbm.xml file i am facing the below error.

org.springframework.orm.hibernate.HibernateobjectRetrivalFailureException: object with id:22 was not of the specified subclass:(path of table1 related class)(Discriminator :entry1) nested exception is net.sf.hibernate.WrongClassException : Object with id:22 was not of the specified subclass:(path of table1 related class)(Discriminator :entry1)

There are no duplicates in my table neither any space issues. none of my new entires are getting executed.Is it due to my .hbm.xml file not getting refreshed everytime.please let me know for any suggestions.

解决方案

Simply, add to project file properties following:

spring.jpa.properties.hibernate.discriminator.ignore_explicit_for_joined=true

It is works for me.

这篇关于WrongClassExceptionObject:id为22的对象不是指定的子类,仅用于新条目.old条目正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆