Jan 18th, 2012, 04:33 AM
Spring Data JPA and checking old state
I've got a mini-workflow system on an entity. call it Order. Order has the states DRAFT, SUBMITTED, PAID, SHIPPED.
I'm currently using Spring Data JPA over Hibernate. Is there a way to figure out in (for example) a @PreUpdate callback, what the old state is, so I can perhaps kick off a JMS message?
I've looked at Hibernate Envers, but that doesn't do it for me, because I don't actually need auditing. The standard @PreUpdate does not give the old state. Is there some other option? Surely other people has run into this type requirement before, but Stack Overflow and Google are strangely silent on solutions...
Jan 18th, 2012, 09:32 AM
using hibernate envers, you can check with the historyreader exactly which values changed and send an event
Jan 18th, 2012, 02:12 PM
I'd really rather not use Envers. I don't actually need auditing. and the creation and storage of these audit entries. I just need a pre-state and a post-state so I can kick off events. Envers seems to be quite a bit of overkill for what I'm trying to do...