-->
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.  [ 3 posts ] 
Author Message
 Post subject: Interceptor problem - data over written
PostPosted: Tue May 31, 2005 6:59 pm 
Newbie

Joined: Thu Dec 02, 2004 2:13 pm
Posts: 10
Hello,

I'm having problems with an interceptor. In certain instances We need to mask data held within an object. We do this using an interceptor. When an object that needs to be masked is loaded, the interceptor sets all of the fields whose data should not be viewable to null. I can step through the code and see that this is occuring correctly. Once this is done though hibernate goes back and repopulates the object.

Looking at the documentation for interceptors (http://www.hibernate.org/hib_docs/v3/re ... le/#events) this seems valid since it says it allows you to do things before an object is loaded, etc... but what would be the point of making changes to an object before it is loaded only to have hibernate undue those changes right away?

Am I not using interceptors properly? Is there a better way to do what I want?


Hibernate version:
3.0.5

Name and version of the database you are using:
DB2

Thanks,

c.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 31, 2005 7:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote from the JavaDoc:

Quote:
/**
* Called just before an object is initialized. The interceptor may change the <tt>state</tt>, which will
* be propagated to the persistent object. Note that when this method is called, <tt>entity</tt> will be
* an empty uninitialized instance of the class.
*


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 01, 2005 1:41 pm 
Newbie

Joined: Thu Dec 02, 2004 2:13 pm
Posts: 10
I thought the interceptor would solve our problem but it doesn't, however, event listeners seem to be the correct answer.

Thanks,

c.


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

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.