Reputation: 299
How would I configure my hibernate hbm file to have a last updated date column? I'm trying to add a lastUpdated column to a legacy database structure. My DBA dislikes triggers and there are many places in the application which saves to the database.
Is there any lastUpdated property that I could add to my hbm or POJO which would automatically enter the time whenever hibernate insert/updates the object?
Thanks!
Upvotes: 1
Views: 1466
Reputation: 3638
You should be able to add @PreUpdate
and @PrePersist
(from JPA) and set up a listener.
Upvotes: 2