文件名称:
jOOQ-manual-3.10.pdf
开发工具:
文件大小: 1mb
下载次数: 0
上传时间: 2019-10-31
详细说明:数据访问未必都使用orm,jooq为sql的开发带来福音,jOOQ-3.10的使用手册The jooQ User Manual
Table of contents
1. Preface
2. Copyright, License, and trademarks
3. Getting started with joOQ………
3.1. How to read this manual
3. 2. The sample database used in this manual
3.3. Different use cases for jooo.……
3.3.1. jOOQ as a SQL builder
18
3.3.2.jooQ as a SQL builder with code generation
3.3.3.j00 Q as a sQl executor.……
19
3.3.4.jooQ for CRUD
3.3.5. jooQ for PROs
3. 4. Tutorials
:
:;.:·
21
3.4.1. jooQ in 7 easy steps
3.4.1.1. Step 1: Preparation
3.4.1.2. Step 2: Your database
6.4.1.3. Step 3: Coce gereration
3.4.1.4. Step 4: Connect to your database
3.4.1.5. Step 5: Querying
::·
3.4.1.6. Step 6: Iterating
26
3.4.1.7. Step 7: Explor
27
3.4.2. Using jooq in modern IDES
3.4.3. Using jooQ with Spring and Apache DBCP
.::
27
34.4. Using jooq with Flyway.……
32
3.4.5. Using jooQ with JAX-RS
38
3.4.5. A simple web application with jooQ……
43
3.5. joCQ and Java 8
3.6. joCQ and JavaFX.
丰丰.
45
3.7. jOCQ and Nashorn
3.8. joCQ and scala
48
3.9. jOCQ and Groovy
3.10. jooQ and Kot in
3.11.jooQ and NOSQL
50
3.12. Dependencies
50
3.13. Build your own
3. 14. jOOQ and backwards-compatibility
::*:::·:·:::::::
4.1. The query dsl typ
·:···:::::
4.1.1. DSL subclasses
54
42 The dsl context class
54
4.2.1. SQL Dialect
4.2.2. SQL Dialect Family……
56
4.2.3. Connection vs Data Source
4.2.4 Custom data
4. 25. Custom executelisteners
58
4.2.5. Custom Setting
4.2.5.1. Object qualification
4.2.5. 2 Runtime schema and table mapping
4.2.5.3. Identifier style
4.2.5. 4 Keyword style
64
4.2.5.5. Parameter types
o 2009-2017 by Data Geekery M GmbH
Fage 3/299
The jooQ UseI Manual
4.2.5.6. Statement Type
4.7.5.7.Execute L ogging
4. 2.5.8. Optimistic Locking
4.2.6.9. Auto-attach Records
··:·
4.2.5.10. Updatable Primary Keys
Reflection caching
4.2.5.12. Fetch Warnings
8
4.2.5.13. Return all Columns on Store
4.2.5.14.Map」 PA Annotations.…
4.2.5.15.」 DBC Flags
4.2.5.16. N-list Padding
4.2.5. 17. Backslash Escaping
4.2.5.18. Scalar subqueries for stored functions
4.3. SQL Statements(DML)
4.3.1. jooQ's DSL and model API
7
43.2. The WITH Clause
.74
433. The select statement
75
4,33.1. The select clause
433.2. The from clause
4.3.3.3. The joIN clause
78
433.4. The Where clause
4335. The connect by clause
433.6. The grop by clause
433.7. The having clause
433. 8. The window cause
4,339. The order bY clause
4.3.3.10. The LIMIT. offset clause
86
43.3.11. The WITH TIFS clause
433.12. The seek clause
4,3.3.13. The for update clause
89
4.3.3.14. UNION INTERSECTION and eXcePt
43.3.15. Oracle-style hints
4.3.3.16. Lexical ard logical SELECT Clause order
93
4,3. 4. The nsert statement
*:
94
4.3.4.1.|NS三R下.∨ ALUES
4342 NSERT DEFAULT VALUES
43.43 INSERT SET
4,34. 4. NSERT. SELECT
4.3.4.5. INSERT. ON DUPLICATE KEY
:.··::::·
4346.NSERT RETURNING
43.5. The uPdate statement
-,--,,,+++
98
4.3.5. The delete statement
,1
4,3.7. The merge statenent
C
4. 4. SQL Statements(DDLy
4.41.The aLTER statement
442. The create statement
4.4.3. The drop statement
4.4.4. The TRUNcate statemer
104
4.4.5. Generaring DDL from objects
4.5. Catalog and schema expression:
4.6. Table expressions
;,
106
4.6.1. Generated Tables
**::·::··:
106
4.6.2. Aliased tables
10
4.6.3. Joined tables
108
o 2009-2017 by Data Geekery M GmbH
Fage 4/299
The jooQ User Manual
4.6. 4. The Values table constructor
110
4.6.5. Nested selects
4.6.5. The Oracle 11g pivot clause
..:.:·
4.6.7. jOOQ's relational division syntax
112
4.6.8. Array and cursor unnesting……
112
4.6.9. Table-valued function
4.6.10. The dual table
4.7. Column expressions
114
4.7.1 Table columns
115
4.72. Aliased columns
4.7.3. Cast expressions
1
4.7.4. Datatype coercions
116
4.7.5. Arithmetic expressions
17
4.7.5. String concatenation
4.7.7. Genera functions
4.7.8. Numeric functions
118
4.7,9. Bitwise functions
119
4.7.10. String functions
4.711. Case sensitivity wth string
47.12. Date and time functions
:
121
4.7.13. System function
4.7.14. Aggregate functions
4.7.15.Window functions
4.7.16. Grouping
functions
4.7.17. User-defined functions
::.::·
127
4.7.18. User-defined aggregate functions
127
4.7.19. The CAsE expression
129
47.20 Secuences and serials
4.7.21. Tuples or row value express ons
4.8. Conditional expressions
4.8.1. Condition building
32
48.2 andOR not boolean operators
132
4.8.3. Comparison predicate
4.8.4. Boolean operator precedence
*·:
134
4.8.5. Comparison predicate(degree 1)
134
4.8.5. Quantified camparison predicate
135
4.8.7. NULL predicate……
136
4.8.8. NULL predicate(degree > 1)
136
4.8.9. DISTINCT predicate
136
4.8.10. BETWEEN predicate……
137
4.8.11. BETWEEN predicate(degree >1)
138
4.8.12. LIKE predicate
138
4.8.13. IN predicate
4.8.14. IN predicate (degree> 1)
40
4.8.15. EXISTS predicate
4.8.16. OVERLAPS predicate
141
4.8.17. Query By Exampe(QBE
4.9. DynamIc SQL….
142
4.10. Plain sQ
4.11. Plain SQL Templating Language
4.12. SQL Parser
146
4.12.1. SQL Parser API
47
4.12.2. SQL Parser Grammar
413. Names and identifiers
o 2009-2017 by Data Geekery M GmbH
Fage 5/299
The jooQ User Manual
4.14. Bind values and parameters
49
4.14.1. Indexed parameters
4.14.2. Named parameters
4.14.3. Inlined oarameters
4.14.4. SQL injection
152
4.15. QueryParts
4.15.1. SQL rendering
4.15.2. Pretty printing SQl
4.15.3. Variable binding,……
155
4.15.4. Custom data tyoe bindings
4.15.5. Custom syntax elements
4.15.6. Plain SQL QueryParts
6
4.15.7. Serializability
4.15.8. Custom SQL trarsformation
4.1.5.8.1. Logging abbreviated bind values
163
4.16. SQL building in Scala
.164
5. SQL
167
5.1. Comparison between jooQ and DBC
5. 2. Query vs. ResultQuery
168
5.3. Fetching….
3.1. Record vs. Table Record
:::·
5.3.2 Record to record22
172
5.3.3. Arrays, Maps and Lists
172
5.3.4 Recordhandler
173
5.3.5. RecordMapper
.173
5.3.5.POOs
174
5.3.7. POJOs with RecordMappers
538. azy fetching……
178
5.3.9. Lazy fetching with Streams
5.3.10. Many fetching
179
5.3.11. Later fetching
180
5.3.12. Resultset fetching
5.3.13. Data type conversion
5.3.14. Interning data
5.4. Static statements vs Prepared Statements
185
5.5. Reusing a Query's Preparedstatement
186
5.6.」 DBC fl e
86
5.7. Using JDBC batch operations
5.8. Sequence execution
5.9. Stored procedures and functions
89
5.9.1 Oracle packages
,+,
5.9.2. Oracle member prccecures
192
5.10. porting to XML:CS∨」SCN,HTML,Tex
92
5.10.1. Exporting XML
92
5. 10.2. Exporting Csv
5.10.3. Exporting jSoN
5.10.4. Exporting HTML
194
5.10.5. Exporting Text.……
194
porting data
5.11.1. mooring Ci
195
5.11.2. Importing soN
196
5.11.3. Importing Records
197
5.11.4. Importing Arrays
5. 11.5.Importing XMI
o 2009-2017 by Data Geekery M GmbH
Fage 5/299
The jooQ UseI Manual
5.12. CRUD With Updatable Records
98
5.12.1. Simple CRUD
198
5.12.2. Records interral flags
5.123 IDENTITY values
··
5.12. 4 Navigation methods
201
5.12.5. Non-updatab e records
202
5.12.6. Optimistic locking
202
5.12.7. Batch execution
203
5.128 CRUD SPI: Recordlistener
204
5.13.DAOs.
204
5.14 transaction management
205
5.15. Exception handling……
208
5.16. Execute Listeners
209
5.1 Database meta data
2
5.18.Parsing Connection
212
5.19. Logging
212
5.20. Per formance considerations
213
5.21. Alternat ve execurion models
214
5.21.1. Using jooQ with Springs abcTemplate
5.21. 2 Usirg jooQ with JPA
5.21.2.1.∪ sing jooQ with JPA Natiⅳ e Query.
521.2.2.∪ sing jooQ with」 Pa entities.
216
5.21.2.3. Using jooQ with ] PA Entity Result
217
6. Code generation
o.1. Configuration and setup of the generator
6.2. Advanced generator contiguration……
5. 2.1. Logging
226
5.2.2.JdbC.
226
6.2.3. Generator
6. 2.4. Database, name, ard properties
5. 2.5. RegexFlags
231
5.2.5. Includes and excludes
237
5. 2.7. Include object types
234
5.2.8 Record Version and Timestamp Fie ds
6. 2.9. Synthetic identities
235
6. 2.10. Synthetic primary keys
236
5. 2.11. Override primary keys
236
5.2.12. Date as timestamp.……
237
6.2.13. Ignore procedure return values(deprecated
5. 2.14. Uns gned types
5.2.15. Catalog and schema mapping
239
6.2.16. Catalog and schema version providers
243
6.2.17. Custom ordering of generated code
6.. Table valued functions
248
5.3. Programmatic generator configuration
249
6. 4. Custom generator strategies
6.5. Matcher strategies
6. 6. Custom code sections
6.7. Generated global artefacts
6.8 Generated tables
258
6.9. Generated records
·:·
6.10. Generated POJOs
260
6.11. Generated Interfa
o 2009-2017 by Data Geekery M GmbH
Fage 7/299
The jooQ UseI Manual
5. 12. Generated daos
6.13. Generated sequences
26
6. 14. Generated procedures
5.15. Generated∪DTS.
.:*:·:丰
6. 16. Data type rewrites
::··:·
6.1/ Custom data types and type conversion
264
5. 18. Custom data type binding
266
6. 19. Mapping generated catalogs and schemas
6. 20. Code generation for large schemas
::·:·:丰
6. 21. Code generation and version control
5. 22. PADatabase: Code generation from entities
270
6. 23. XMLDatabase: Code generation from XML files
72
6. 24. DDLDatabase: Code generation from SQL files
5.25 XMLGenerator, Generating XMl
275
6.26. Running the code generator w th Maven
276
627. Running the code generator with Ant……
276
28. Running the code generator with gradle……
277
7. Tools
279
/1. DBC
7.2. API validation using the Checker Framework
281
3.SQL2j0 oQ Parser……
7. 4. jOCQ Console
…
284
3. Referer
2S5
8.1. Supported RDBms
285
8.2. Data types…
285
8.2.1. BLOBs and CLOBs
286
8.2.2. Unsigned integer type
8. 2.3. INTERVAL data types
287
8.2.4. XML data types
8.2.5. Geospacial data type
8.2.5. CURSOR data types
288
8.2.7. ARRAY and TABl E data types
288
8.2.8. Oracle DATE data type
288
8.3. SQL to DSL mapping rules
8.4. jOOQ's BNF pSeudo-notation
292
8.5. Quality Assurance
292
8.6. Migrating to joCQ 3.0
294
8.7 Credits
o 2009-2017 by Data Geekery M GmbH
Fage 8/299
The jooQ User Manual
Preface
1. Preface
jOOQ's reason for being- compared to JPa
ava and SQL have come a long way. SQL is an "old", yet established and well-understood technology
Java is a legacy too, although its platform VM allows for many new and contemporary languages built on
top of it. Yet, after all these years, libraries dealing with the interface between SQL and java have come
and gone, leaving JPA to be a standard that is accepted only with doubts, Short of any surviving options
So far, there had been only few database abstraction frameworks or libraries, that truly respected SQL
as a first class citizen among languages. Most frameworks, including the industry standards JPA, EjB,
Hibernate, JDO, Criteria Query, and many others try to hide sQL itself, minimising its scope to things
called PQL, Hql, doQl and various other inferior query languages
ooQ has come to fill this gap
OoQ's reason for being- compared to LINQ
Other platforms incorporate ideas such as LINQ(with LINQ-to-SQL), or Scala's SLICK, or also Java's
QueryDSL to better integrate querying as a concept into their respective language. By querying, they
understand querying of arbitrary targets, such as SQL, XML, Collections and other heterogeneous data
stores. jooo claims that this is going the wrong way too
In more advanced querying use-cases(more than simple CRUd and the occasional JOIN), people will
want to profit from the expressivity of SQL. due to the relational nature of SQL, this is quite different
from what object-oriented and partially functional languages such as C#, Scala, or Java can offer
It is very hard to formally express and validate joins and the ad-hoc table expression types they create
It gets even harder when you want support for more advanced table expressions, such as pivot tables,
unnested cursors, or just arbitrary projections from derived tables. With a very strong object-oriented
typing model, these features will probably stay out of scope
In essence, the decision of creating an API that looks like SQL or one that looks like C#, Scala, Java
is a definite decision in favour of one or the other platform. While it will be easier to evolve SLicK in
similar ways as LINQ (or Query DSL in the Java world), SQL feature scope that clearly communicates
its underlying intent will be very hard to add, later on(e. g. haw would you model Oracle's partitioned
outer join syntax? How would you model ANSI/ISo SQL: 1999 grouping sets? How can you support scalar
subquery caching? etc.
ooQ has come to fill this gap
jOOQ's reason for being-compared to SQL/ jDBC
So why not just use SQL?
SQL can be written as plain text and passed through the DBC APL. Over the years, people have become
wary of this approach for many reasons
o 2009-2017 by Data Geekery M GmbH
Fage 9/299
The jooQ User Manual
No typesafety
No syntax safety
No bind value index safety
Verbose sql string concatenation
Boring bind value indexing techniques
Verbose resource and exception handling in JDBC
A very"stateful, not very object-oriented JDBC APL, which is hard to use
For these many reasons, other frameworks have tried to abstract JDBC away in the past in one way or
another. Unfortunately, many have completely abstracted SQL away as wel
jooQ has come to fill this gap
ooQ is different
SQL Was never meant to be abstracted To be confined in the narrow boundaries of heavy mappers,
hiding the beauty and simplicity of relational data. SQL Was never meant to be object-oriented SQL
was never meant to be anything other than... SQL
o 2009-2017 by Data Geekery M GmbH
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.