> I have a CMP 2.0 Entity bean that represents a row in a table of my DB.
> I've got numerous abstract setters and getters. However, one of the
> columns in my DB is a timestamp and I want it to reflect the time -
> ACCORDING TO THE DB - when that row was updated. Without using an CMP
> 2.0 entity bean I'd simply do something like this:
> update customer set lastHeartBeat=sysdate where id=55;
> Any light you can shed would be appreciated.
Three possible solution came into my mind:
1. create a database trigger for update and insert on this table and
fill the column with the sysdate value.
2. use the session facade pattern. All modifications for the entity bean
are done using a session bean. Every time a file is changed you change
the value for the lastHartBeat too.
3. use a application server specific feature. JBoss supports audit
fields for created-by, created-time, updated-by, updated-time. The
server fills in the name or timestamp before updating the database.
the Rat - 13 Mar 2006 21:52 GMT
I'm trying to do this in a DB and application server-independent way -
so I don't think #1 or #3 (above) will work. Can you elaborate more on
#2? Remember, I'm trying to update the time according to the DB - not
the application server.
Thanks!
-john