Initial support for Container Managed Audit Fields
Initially in 3.2 for evaluation purposes.
Coding this in CMP2 is a pain and requires
calculating the values on every set, monitoring
whether the set actually changed the value.
In jbosscmp-jdbc.xml add
<audit>
<created-by/>
<created-time/>
<updated-by/>
<updated-time/>
</audit>
to the relevent entity.
Four new fields are maintained by the CMP engine
audit_created_by, audit_created_time,
audit_updated_by, audit_updated_time
For created_by and updated_by the caller principal
must be in the entity context otherwise
they are blank.
You can choose which of the fields you want to
use e.g.
<audit>
<updated-by/>
<updated-time/>
</audit>
You can change the column names as follows
<updated-by><column-
name>change_user</column>name></updated-by>
The field can also be a CMP field, by matching
the field-name
<updated-by><field-name>changedBy</field-
name><updated-by>
When the field is set programmatically this takes
precedence over the container managed values.
TODO
1) Decide and support relevent jdbc-type/sql-types.
2) Support date and time as separate fields
for legacy data mappings
3) Add support for CMR tables.
Regards,
Adrian