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

many to many Setting Value Problem

Former Member
0 Kudos
246

hi , all experts. i faced a very strange problem.
i created a production plan model in items, it has a many-to-many relation with orders.

follow is code

         <relation code="B2BFeedingPlanHeadInfo2Order" generate="true" localized="false" autocreate="true" ` >
               <deployment table="B2BFeedingPlanHead2Order" typecode="31011"/>
             <sourceElement type="B2BFeedingPlanHeadInfo" qualifier="b2bFeedingPlanHead" cardinality="many" collectiontype="list">
                 <modifiers read="true" write="true" search="true" optional="true" partof="true"/>
             </sourceElement>            
             <targetElement type="Order" qualifier="order" cardinality="many" collectiontype="list">
                 <modifiers read="true" write="true" search="true" optional="true" partof="true"/>
             </targetElement>
         </relation>

when I update the order list in the plan. like this,

 B2BFeedingPlanHeadInfoModel model = flexibleSearchService.getModelByEXAMPLE("...")
 ......  
 model.setOrder(orders);
 modelService.save(model);
 

some orders associated with the plan will be deleted. it's physical deletion. cascading deletion? but i did not perform remove operation.

experts, please help.....

Accepted Solutions (1)

Accepted Solutions (1)

arvind-kumar_avinash
Active Contributor
0 Kudos

The root cause of this problem is partof="true" with both, source and target. You should also consider revisiting your relation. What is the use case? If the use case is to delete the B2BFeedingPlanHeadInfo on deleting the Order, you should change B2BFeedingPlanHeadInfo to target with partof="true".

Finally, I also recommend a good article on partOf: https://wiki.hybris.com/display/~/PartOf+attribute

arvind-kumar_avinash
Active Contributor
0 Kudos

Hi - did it help? If not, you can post the solution that worked for you so that it can be helpful to others.

Former Member
0 Kudos

thank you for your help. i will remove part-of and test it.

arvind-kumar_avinash
Active Contributor
0 Kudos

You are most welcome.

Answers (0)