Skip to Content

Unable to register Custom Model in PrepareInterceptor

Hi,

I have piece of code in my custom Interceptor which extends Prepare Interceptor.

SafetyInfoModel safetyInfoModel = modelService.create(SafetyInfoModel.class);

                 safetyInfoModel .setCatalogVersion(paramModel.getCatalogVersion());
                 safetyInfoModel .setCode(paramModel.getCode());
              
                 paramModel.setLOrealSafetyInfo(safetyInfoModel );

Here I need to persist the SafetyInfoModel . But I cannot use The modelService.save(SafetyInfoModel) in prepare Interceptor. Is there any good way to do this.

Looking forward to response.

Regards, Yashwanth

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Sep 14, 2016 at 07:24 PM

    The interceptorContext object has a way to ask for items to be saved (after the interceptor returns)

     interceptorContext.registerElementFor(safetyInfoModel, PersistenceOperation.SAVE);
     
    
    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.