JPA: mapping situation: List<? extend someClass>

View: New views
1 Messages — Rating Filter:   Alert me  

JPA: mapping situation: List<? extend someClass>

by ttt_jpa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everyone,

For the mapping case of List <? extends someClass>, it is clear to see that this mapping is a combination of class association (One-to-Many) and inheritance.

I can handle this mapping, database schema can be generated, storing and retrieving objects also no any problem.

But I encounter the problem of over-writing the old list in database with the new list in client code even though I have used "DELETE_ORPHAN" extended annotation from Hibernate.

Please notice that, for the mapping case of List<someConcreteClass>, the "DELETE_ORPHAN" extended annotation can help to solve the problem.
But for the mapping of List<? extend someClass>, it does not help at all.

I always get the following error:
org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance

Attached is the class diagram for the data model which describe that a Person has a list of BillingDetails which can be either BankAccount or CreditCard

Any reply, suggestion or help is very welcome.

Thanks much
Person_BillingDetails.jpg
LightInTheBox - Buy quality products at wholesale price!