Menu

#239 Container Managed Audit Fields

v3.2
open
nobody
JBossCMP (36)
5
2003-02-13
2003-02-13
No

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

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.