Women in Technology

Hear us Roar



Article:
  JBoss Optimizations 101
Subject:   How to utilize this with a session facade
Date:   2003-06-09 16:00:44
From:   anonymous2
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
jonmartin.solaas@mail.link.no
www.objectlabs.no

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • How to utilize this with a session facade
    2003-06-09 19:27:33  anonymous2 [View]

    The read-only tag in jboss.xml (and not the one in jbosscmp-jdbc.xml) is about enrollement in the current transaction and locking. Consequently, it has no sense in the case of a session bean (but only in the case of an entity bean. In your case, you may simply want to deploy the same EJB twice: one with RO, and one witout RO.

    Cheers,


    sacha