"org.hibernate.collection.PersistentBag cannot be cast to java.util.ArrayList"
I have exactly this same message using annotations when I try to access a List<Object> I have on one of my classes. I had no problems using the List Interface collections until now.
The code is this:
Code:
e.estEmps = (List<EstEmp>)((ArrayList<EstEmp>)this.estEmps).clone();
The collection 'this.estEmps' is retrieved from the database, it usually works, so it's correctly mapped, but this time I needed to make a clone() of the complete List collection, so I made the cast to ArrayList and found that it throwed an exception.
I need to return a List for the assignment on the left side, so I don't mind changing the Collection, but I never used the PersistentBag and don't know how to handle in order to get a Collection implementing the List interface. I looked the reference and didn't find anything returning List.
Please help!