I have 2 class, one that inherits from the other and I'm using InheritanceType.SINGLE_TABLE with a column that identifies if the entry belongs to the base class or to the derived class.
This is the base class:
And this is the derived class:
To load the object from the database I use the following method:
Where utenteClass is either the base class or the derived one.
I've used this approach before and it worked. While now, even if the utenteClass is the derived class (if I debug I can see it), in the query that is generated the discriminator from the base class is used:
I really can't find the difference from the other project of mine in which this works. I need to use the right class since I need the right object to be instantiated and all the fields of the derived class to be populated.
What can be the reason for which this does not work? Is there another way to get what I need?
Thanks for any help.