عرض عملي: مفاجآت التسلسل وحذف اليتامى
في هذا الدرس 3 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
see what cascades and orphan removal really do; prepares JNR-030-LAB1.
تفاصيل المخطط المبدئي
خطوة بخطوة
- Remove one line from the order's list and commit; the log shows a
deletefor that line only. - Replace the whole list with
order.setLines(newList)and show the orphan-removal error ("collection was no longer referenced") and why to mutate the same collection. - Planned mistake: put
CascadeType.ALLonOrderLine.product; delete an order and watch it try to delete a product used elsewhere (constraint error). - Remove the cascade and show the order deletes alone.
- Summarize: cascade only parent-to-owned-children.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.