Hello, I might be asking trivial question, but could not find an answer to it anywhere...
My Consumer entity has a primary key ID, which is a generated value taken from DB sequence. In addition to that I need to assign to every Consumer obfuscated ID (which later on will be exposed to third parties) It's a unique value, which is generated by application obfuscation module based on entity ID.
I cannot use @PrePersist annotation, since at this point entity ID is not generated yet and I'll only have it after flushing the persisted object. When I try to use @PostPersist, entity gets obfuscated ID correctly, but it is not persisted within database after all. I need some kind of @PreCommit callback method. Is there such a thing? Or maybe there is another way to assign and persist values of the entity after it was inserted into the database?
Thanks.
|