I have some code where I have a EJB3 entity bean with an EntityListener on it. In my post methods in the EntityListener (e.g. postPersist, postRemove, postUpdate) a handler attempts to serialize the entity bean and transfer it to a remote location. During the deserialization at the remote location, I get a ClassCastException related to the org.hibernate.collection.PersistentBag class. My assumption was that hibernate would not be involved at this point. That the EntityListener methods would be executed after the transaction had completed and thus the entity would be detached and hence a standard POJO again. Is this not true? I tried to find anything about transactions and EntityListeners in the spec and I did not see anything one way or the other on the subject. I am sorry if I am just missing it.
You know, that is a fantastic question. I'm having that same problem. Any help please?!?!