on 2019 Jan 02 9:29 AM
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.....
Request clarification before answering.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.