- In most parts of this manual, it is assumed that you do not use the simple SELECT API.
+ In most parts of this manual, it is assumed that you do not use the simple SELECT API. For more information about the simple SELECT API, see the manual's section about
+ jOOQ understands that SQL is much more expressive than Java, when it comes to the declarative typing of
+ When fetching data only from a single table, the
+ When you use the
+ With the introduction of generics in Java 5, it is possible in principle, to pre-define a set of tuple types. This is what Scala does. In essence, tuple types look something like this: +
+ ++ It is worth mentioning that Scala is much stronger in inferring types than Java. Yet still, this becomes quickly impracticable as +
++ For these reasons jOOQ does not support generic tuples. +
+
+ By default, jOOQ returns an
+ Note that most of these convenience methods are available both through
+ In a more functional operating mode, you might want to write callbacks that receive records from your select statement results in order to do some processing. This is a common data access pattern in Spring's JdbcTemplate, and it is also available in jOOQ. With jOOQ, you can implement your own
+ Fetching data in records is fine as long as your application is not really layered, or as long as you're still writing code in the DAO layer. But if you have a more advanced application architecture, you may not want to allow for jOOQ artefacts to leak into other layers. You may choose to write POJOs (Plain Old Java Objects) as your primary DTOs (Data Transfer Objects), without any dependencies on jOOQ's
+ If you're using jOOQ's
+ jOOQ tries to find JPA annotations on your POJO types. If it finds any, they are used as the primary source for mapping meta-information. Only the
+ Just as with any other JPA implementation, you can put the
+ If jOOQ does not find any JPA-annotations, columns are mapped to the "best-matching" constructor, attribute or setter. An example illustrates this: +
+ +
+ Please refer to the
+ jOOQ also allows for fetching data into abstract classes or interfaces, or in other words, "proxyable" types. This means that jOOQ will return a
+ Please refer to the
+ The above examples show how to fetch data into your own custom POJOs / DTOs. When you have modified the data contained in POJOs, you probably want to store those modifications back to the database. An example of this is given here: +
+ +
+ Note: Because of your manual setting of ID = 10, jOOQ's store() method will asume that you want to insert a new record. See the manual's section about
+ If you're using jOOQ's
+ jOOQ currently doesn't support more complex data structures, the way Hibernate/JPA attempt to map relational data onto POJOs. While future developments in this direction are not excluded, jOOQ claims that generic mapping strategies lead to an enormous additional complexity that only serves very few use cases. You are likely to find a solution using any of jOOQ's various