-->
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: Override or ignore @PrePersist via configuration -possible?
PostPosted: Fri Jun 24, 2011 2:15 pm 
Newbie

Joined: Fri Jun 24, 2011 1:29 pm
Posts: 1
I am writing a stand-alone add-on module for an application that uses a library with JPA-annotated domain entity objects. The application itself is already in Production, it has been deployed at the customer site, and no libraries should be modified/redeployed. Here's the issue I am facing. My new module has to use the exact same version/instance of the domain library the existing application is using - it is the requirement. However, the existing entity classes (that I cannot touch) have @PrePersist-annotated methods that, unfortunately, do stuff that prevents my module from properly persisting the entities that my process populates. In other words, the existing domain model - unfortunately - was originally hard-wired to work in a particular scenario when the new entities could only be created by one client application, and that scenario required generating and setting certain values on the entities before persisting them. So, that was burnt into the model. Now, there is an urgent requirement to allow other processes to populate and load entities into the system - with those values already set on the entity. For example, normally the @PrePersist-annotated method would generate a new value and set it on a private property. For my application, I need to populate that property via a public setter bypassing the @PrePersist-annotated method. Is it possible to do without extending the class and overriding the method? What if I use an entity interceptor and implement the onSave() method? Would it override the @PrePersist annotation? Or, is it possible to disable/ignore a specific annotation?

Thanks,
Alec


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.