Skip to Content
author's profile photo Former Member
Former Member

Recursively saving model in validator interceptor

Hi, I have written a validator interceptor in which i am performing some validations for model (model1) before saving the model. I have some other model (model 2)which is having reference of model1 and need to save model2 as well in the validator. SInce model2 is having reference of model1 the validator interceptor is getting called recursively. Is there any way to save model2 inside the validator or after the validator gets invoked for model1.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on May 13, 2015 at 04:13 PM

    Hi Neha,

    I hope you are not doing any save operation in validator interceptor. Have u defined your validator interceptor only for Type1? Validator interceptor shouldn't have any logic to save the model. Whenever you will invoke the save method it will again invoke the validator interceptor.

    It should be used to do the validation and throw the interceptor exception in case of failure.

    If you have to set some default value use initdefault interceptor. Prepare interceptor could be also used to prepare data for a model.

    Thanks, Abhishek

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.