jOOQ عمليًا
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
write type-safe SQL with generated classes.
الموضوعات المخطط لها
- jOOQ generates Java classes from the database schema (tables, columns, types) through a code generator in the build.
- You write SQL as Java methods; the compiler catches renamed columns and wrong types.
- It supports modern SQL (CTEs, window functions,
ON CONFLICT) and maps results to records or DTOs. - Integrates with Spring transactions through
DSLContextusing the sameDataSource. - Generate from a migrated database (Flyway plus Testcontainers) so the code and schema agree; verify licensing for your database edition before recording (open-source edition supports PostgreSQL).
تفاصيل المخطط المبدئي
عرض عملي
var rows = dsl.select(PRODUCT.CATEGORY_ID, DSL.sum(ORDER_ITEM.PRICE_CENTS))
.from(ORDER_ITEM).join(PRODUCT).on(PRODUCT.ID.eq(ORDER_ITEM.PRODUCT_ID))
.groupBy(PRODUCT.CATEGORY_ID)
.fetch();اختبر فهمك
What does the compiler catch that a SQL string would not?
أظهر الإجابة
A renamed column or a type mismatch.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.