cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Model is not getting Saved for second time

former_member657303
Discoverer
0 Kudos
979

Hi All,

I have written code for category model, which updates classifying Attributes and saves the category model.

This is working fine for the first time. But when I try to execute the same code. Model is not getting saved.

Could anyone please help me what I am doing wrong? below is the sample code snippet

 List<Response> response = classAttributeService.requestAttributes(category.getCode());
   
 categoryService.populateClassifications(response , category);  
 modelService.save(category);  

Thanks in Advance

Accepted Solutions (0)

Answers (1)

Answers (1)

a_e_dubey
Active Participant
0 Kudos

You can try follow way

  • After first save try to refresh model

modelService.refresh(model);

  • Or still you face issue then after first save detach model may be that model remains in service layer and updated model on second time could not be able to update exiting one

modelservice.save();

modelservice.detach(model);

  • Even if it does not work use modelService.saveAll() but not recommended. Only use if it realy required.

I hope this will help you.

former_member657303
Discoverer
0 Kudos

Thanks for your help. But still it doesn't work. don't know what is really missing