Hi,
I want to save the DB timestamp value in one of the table column based on some business logic. Is there any option in hibernate to get the DB timestamp & set that value into EO while saving?
I have found following options but those will not helps in my scenario, I want to know if other alternatives are available.
1) Create an Oracle trigger which will invoke base on before insert/update/delete for each row of Deal history Table. In the Update clause, we need to check based on step status code and update the timestamp accordingly. (This should be the straight cut through way without even need to make modification to the current code as oracle trigger will override the value upon trigger happened). Cons-- Some business logic not able to implement in trigger.
2) Hibernate formula and checks attributes for column mapping can be used as well (but I need to try this out, haven’t play with this piece before J)… need to do a formula as something like this….. <formula> case when step_status_code = ‘02’ then 'update maker_timestamp' else '' end </formula> Cons--- approach is not do-able for update cycles… only insert cycles are permitted for auto-defaulting
3) Do a select of sysdate before any insert/update of deal history in the code.
Cons--We have few places in the code which we are doing the saving and bad thing is for batch process, we can’t escape on having multiple fetch of sysdate when we are going to insert for each records
|