Hi,
We try to enforce proper encapsulation in our domain-model, by creating public interfaces for business-entities, and package-private classes that implement those interfaces, and contain JPA (or Hibernate) annotations.
However, this is impossible to do, once you need to map an association, in which the mapped property references the interface, and the targetEntity attribute is required to tell Hibernate the concrete class that should be used.
If the associated class is in a different package, as is often the case, and is not public - then it is impossible to map.
The implication is that JPA forces us to make all entities public.
Is there any solution?
Thanks,
Naaman
|