-->
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: Throwing exceptions from an Interceptor
PostPosted: Mon Nov 08, 2004 6:10 pm 
Newbie

Joined: Mon Nov 08, 2004 6:03 pm
Posts: 8
Hi, I am using an Interceptor so that I can validate values in my entity object just before they are saved. So, for example in the Interceptor's onSave() method I will throw an exception if some validation rule fails. The problem is that I want to continue using the same Session afterwards but I get an exception when the Session is flushed because the previous Entity object that failed validation still resides in some private structures of the Session. Evicting this object from the Session when a validation error occurs fails also (I get an AssertionFailure because the failed entity doesn't have an id). Am I using the Interceptor wrong? Is there another way to do this? I suppose I could call clear() on the Session but I really would like to just remove the failed entity from the session's internal structures. NOTE, the exception that I raise in the Interceptor isn't a hibernate exception just a runtime check (business rule check) before I save, kinda like a JDO-like InstanceCallback.

Thanks for any help,
Mike


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.