I obtain a collection of related records via CMR and then I try adding an entity to that collection and I recieve the following error from JBoss:
javax.ejb.EJBException: This collection is a read-only snapshot
at this following line:
I've also tried taking out my read-only xdoclet tags for the get* methods but then I run into transactional exceptions.
Can anyone point me in the right direction as to how to properly add entity beans via CMR?
Thanks in advance
Read the objects from the returned collection and create a new one into which you can insert any other objects you like.
Let me tell you that if your query returns a collection of entities you cannot return that collection to the client, you should instead create a new collection of DTOs (the Data Transfer Object pattern), each DTO corresponding to an entity and return to the client the new collection.