Menu

#270 <check-dirty-after-get>

v3.2
open
nobody
JBossCMP (36)
5
2003-11-28
2003-11-28
No

A <cmp-field> in jbosscmp-jdbc.xml has got an optional
<check-dirty-after-get> element which can contain true
or false.

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

If field's type is mutable and its value can be changed
without invoking its setter, e.g.
myBean.getMyCMPField().setValue(), the field should
have check-dirty-after-get set to true.
Value true means that the field will be checked for
dirty state at synchronization time even if only the
getter was invoked in a transaction.

By default, check-dirty-after-get is set to false only
for primitive, its wrapper and java.lang.String types.

WARN: if the BLOB type is immutable the
check-dirty-after-get should be false.

Discussion

  • Richard P. O'Sullivan

    Logged In: YES
    user_id=928242

    Should the default be check-dirty-after-get=false for
    java.math.BigDecimal, java.sql.Date, java.sql.Time,
    java.sql.Timestamp and java.util.Date?
    The default, check-dirty-after-get=false, for _only_
    primitives, wrapped primitives and java.lang.String creates
    updates after selecting rows that have columns with the
    types listed above. I observed the SELECT/UPDATE behavior
    in V3.2.3 when perfoming findByPrimaryKey() on a row with
    java.math.BigDecimal (DECIMAL) and java.sql.Date (DATE).
    The databases used were Pointbase and Informix.

     
  • Alexey Loubyansky

    Logged In: YES
    user_id=543482

    Yes for BigDecimal, as it is immutable. No for Date/time
    classes as they are mutable.

     
  • Widerlund

    Widerlund - 2004-03-04

    Logged In: YES
    user_id=988600

    Why does JDBCTypeFactory default to CMPFieldStateFactory
    INVALID_UNLESS_NULL? Can the equals() method not be
    trusted for mutable field types?

     

Log in to post a comment.