Use different List type in Entity classes

Dear community,

I have a project with Eclipse EMF generated classes. The entity classes contain EMF EList<> as collections. I mapped them with @OneToMany, @ManyToMany

I always get following error during persistence:

java.lang.ClassCastException: class org.hibernate.collection.spi.PersistentList cannot be cast to class org.eclipse.emf.common.util.EList

When I replace the EList with List everything works fine. But for maintenance reasons it is bad, because a new code generation will override my changes. The model is very large.

Is there a way to teach Hibernate an Elist or convert it somehow?
I did not find any answer in discussions and the documentation.
Perhaps someone can help here?

SIncerely
Florian

You can do that, but then you need to annotate every such field specially and create a custom collection subtype as explained here: Hibernate ORM User Guide