انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهJNR-030-L07

عرض عملي: ربط Order وOrderLine كتجميع (Aggregate)

  • الدرس 7 من 8
  • Junior
في هذا الدرس 3 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

map the order aggregate; prepares JNR-030-LAB1.

تفاصيل المخطط المبدئي

خطوة بخطوة

  1. Create Order (id, customer, status, createdAt) and OrderLine (id, product, quantity, unitPrice).
  2. Add @ManyToOne(LAZY) from Order to Customer and from OrderLine to Product.
  3. Add lines with cascade = ALL, orphanRemoval = true and the addLine/removeLine helpers.
  4. Planned mistake: add a line to the list without setting line.setOrder(this); show the null foreign key error and fix it with the helper.
  5. Save an order and read the SQL log: one order insert, then one insert per line.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.