JBoss.org Community Documentation
JBoss allows for read-only CMP fields by setting the read-only and read-time-out elements in the cmp-field declaration. These elements work the same way as they do at the entity level. If a field is read-only, it will never be used in an INSERT or UPDATE statement. If a primary key field is read-only, the create method will throw a CreateException. If a set accessor is called for a read-only field, it throws an EJBException. Read-only fields are useful for fields that are filled in by database triggers, such as last update. A read-only CMP field declaration example follows:
<jbosscmp-jdbc>
<enterprise-beans>
<entity>
<ejb-name>GangsterEJB</ejb-name>
<cmp-field>
<field-name>lastUpdated</field-name>
<read-only>true</read-only>
<read-time-out>1000</read-time-out>
</cmp-field>
</entity>
</enterprise-beans>
</jbosscmp-jdbc>