I am trying to persist objects in a database using hibernate JPA.
The objects already have a type hierarchy, and I'm trying to make it work with hibernate.
A CatalogPackage
object has all the important properties and all the getters.
A CatalogPackageImpl
(extends CatalogPackage
) object has no properties, but most of the setters.
Both classes are non-abstract.
We want code to refer to CatalogPackage
objects. But when initializing hibernate, it complains about the setters missing from the CatalogPackage
class.
How do I suggest to hibernate that it use the subclass when building the objects?
I don't want to move all the setters to the superclass, and I don't want to use CatalogPackageImpl
as the entity.