Sleep mode: change discriminator. Subclass value throws org.hibernate.WrongClassException

I have a class A with subclasses B and the C .
I use InheritanceType.SINGLE_TABLE , and a single column type is used as DiscriminatorColumn.

Class B used to have DiscriminatorValue ("1") , and class C had DiscriminatorValue ("2") . I have another 100 entries in the table and everything is working fine.

Now I created another subclass of A , D . But I wanted him to have DisccriminatorValue ( "1") , so I changed DiscriminatorValues Bed and and C 2 and 4, respectively.
I also updated the database column with corresponding values.

But now, when I run the application, I get the following exception:

org.hibernate.WrongClassException: Object with id: 9 was not of the 
specified subclass: com.example.D (Discriminator: 1)

What is the problem?

+2
source share
2 answers

Nothing. I understood the problem. There was no entry for class D in persistence.xml . Now it works great.

+3
source

, "" .

, , "" ( "g" ) , "".

:

, -.

0

All Articles