Announcement Announcement Module
No announcement yet.
Spring Data JPA and checking old state Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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...


  • #2
    using hibernate envers, you can check with the historyreader exactly which values changed and send an event


    • #3
      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...