Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
jOOQ Masterclass

You're reading from  jOOQ Masterclass

Product type Book
Published in Aug 2022
Publisher Packt
ISBN-13 9781800566897
Pages 764 pages
Edition 1st Edition
Languages
Author (1):
Anghel Leonard Anghel Leonard
Profile icon Anghel Leonard

Table of Contents (26) Chapters

Preface 1. Part 1: jOOQ as a Query Builder, SQL Executor, and Code Generator
2. Chapter 1: Starting jOOQ and Spring Boot 3. Chapter 2: Customizing the jOOQ Level of Involvement 4. Part 2: jOOQ and Queries
5. Chapter 3: jOOQ Core Concepts 6. Chapter 4: Building a DAO Layer (Evolving the Generated DAO Layer) 7. Chapter 5: Tackling Different Kinds of SELECT, INSERT, UPDATE, DELETE, and MERGE 8. Chapter 6: Tackling Different Kinds of JOINs 9. Chapter 7: Types, Converters, and Bindings 10. Chapter 8: Fetching and Mapping 11. Part 3: jOOQ and More Queries
12. Chapter 9: CRUD, Transactions, and Locking 13. Chapter 10: Exporting, Batching, Bulking, and Loading 14. Chapter 11: jOOQ Keys 15. Chapter 12: Pagination and Dynamic Queries 16. Part 4: jOOQ and Advanced SQL
17. Chapter 13: Exploiting SQL Functions 18. Chapter 14: Derived Tables, CTEs, and Views 19. Chapter 15: Calling and Creating Stored Functions and Procedures 20. Chapter 16: Tackling Aliases and SQL Templating 21. Chapter 17: Multitenancy in jOOQ 22. Part 5: Fine-tuning jOOQ, Logging, and Testing
23. Chapter 18: jOOQ SPI (Providers and Listeners) 24. Chapter 19: Logging and Testing 25. Other Books You May Enjoy

Hooking POJOs

You already know that jOOQ can generate POJOs on our behalf and it can handle user-defined POJOs, too. Moreover, you saw a significant number of mappings of a jOOQ result into POJOs (typically, via fetchInto()); therefore, this is not a brand new topic for you. However, in this section, let's take a step further and really focus on different types of POJOs that are supported by jOOQ.

If all we configure is <pojos>true</pojos> (here, Maven), then jOOQ generates POJOs with private fields, empty constructors, constructors with arguments, getters and setters, and toString(). However, jOOQ can also handle a very simple user-defined POJO such as this one:

public class SimplestCustomer { 
   public String customerName; 
   public String customerPhone; 
}

Here is a query that populates this POJO:

List<SimplestCustomer> result = ctx.select(
   CUSTOMER.CUSTOMER_NAME, CUSTOMER.PHONE.as("customerPhone...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}