I\'m trying to get the old entity in a @HandleBeforeSave event.
@Component
@RepositoryEventHandler(Customer.class)
public class CustomerEventHan
You're currently using a spring-data abstraction over hibernate. If the find returns the new values, spring-data has apparently already attached the object to the hibernate session.
I think you have three options:
save an object too an hibernate session when another infect with the same type and id it's known to our. Use merge or evict in that case.onFlushDirty has both values as parameters. Take note though, that hibernate normally does not query for previous state of you simply save an already persisted entity. In stead a simple update is issued in the db (no select). You can force the select by configuring select-before-update on your entity.