Hi,

I'm trying to persistent an existing code base. While it works really well, I've one situation I cannot solve.

Few classes contain some "collection of interfaces". The target entities are not classes, but java interfaces like this:
private Collection<Employable> employees = new ArrayList<Employable>();

I know that I can specify the element type of the target with "targetEntity=Employee.class". But of course this only works if there is an one-to-one correlation between the interface Employable and the class Employee. But I have more than one class implementing the Employable interface.

While with OneToOne relations I could specify directly the java interface as the targetEntity, I have no real success with one-to-many relations. In every case the content of the relationship is stored as a BLOB inside of my class with the warning "openjpa.MetaData - OpenJPA cannot map field ...".

As far as I've understood, the JPA spec is not covering this aspect. Anyways I'm wondering if I'm the only one with the problem. Is there a way to make the one-to-many relation with interfaces work as the one-to-one relation or am I misunderstanding something?

Thanks very much,
Christian Neumann

Reply via email to