Having a bunch of entitybeans and some CMR fields I experience a problem setting all get* methods read-only. My session facade sometimes gets a collection of CMR interfaces and want to add or delete a member of the CMR collection. The read-only attribute of those CMR getters won't allow this, jboss mumbles "This collection is a read-only snapshot". On the other hand, I'd like to keep the read-only attribute for those cases where the CMR stuff is really read-only.
Does it make any sense to put the read-only attribute on the business methods in the session bean facade instead? This would solve my problem, but it doesn't intuitively sound like one can do this. Do I have to make duplicate entity beans in order to have one version that is complete read-only for all getters and one who is only read-only for non-cmr fields (getters) that I can use in the methods that actually need to update cmr fields?
I've also read in the jboss forums that cmr fields shouldn't be declared with abstract getters and setters in the ejb (or interfaces), only in ejb-jar.xml? I have found this strange, and all my entity benans have their cmr-fields declared as abstract getters and setters in the beans. Is this somehow wrong and perhaps the cause of the problem?
Jon Martin Solaas