-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Modification of persistent entity within @PostPersist method
PostPosted: Wed Dec 14, 2011 6:18 pm 
Newbie

Joined: Wed Dec 14, 2011 6:06 pm
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.