Version 3

    check-dirty-after-get

     

    Since 3.2.3.

     

    A <cmp-field> in jbosscmp-jdbc.xml can have an optional child element <check-dirty-after-get> with allowed values true and false.

     

    <cmp-field>
       <field-name>aCmpField</field-name>
       <check-dirty-after-get>true</check-dirty-after-get>
    </cmp-field>
    

     

    If a CMP field is of a mutable type then its value can be modified by invoking the field's getter and just changing the returned value w/o invoking then the field's setter method. Suppose, we have a CMP field of type java.util.Map. Then we could modify it with

     

    entityBean.getCmpFieldMap().put("newKey", "newValue");
    

     

    The check-dirty-after-get set to true means that a CMP field might be modified w/o calling the field's setter and if the getter was called in a transaction, at synchronization time this field should be checked for dirty state. If check-dirty-after-get is false then the field will not be checked for dirty state unless its setter was called in the transaction.

     

    By default, check-drity-after-get is false for fields of primitive types, their wrappers, java.lang.String, java.math.BigInteger and java.math.BigDecimal. Fields of other types, by default, get check-dirty-after-get set to true. So, if a field has a custom type that is expensive for dirty checking then keep this option in mind.