Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
ab1cc829
Commit
ab1cc829
authored
Jun 23, 2015
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add jOOQ sample application
See gh-2804
parent
a08b0956
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
2385 additions
and
0 deletions
+2385
-0
pom.xml
spring-boot-samples/pom.xml
+1
-0
README.adoc
spring-boot-samples/spring-boot-sample-jooq/README.adoc
+9
-0
Keys.java
...sample-jooq/gensrc/main/java/sample/jooq/domain/Keys.java
+81
-0
Public.java
...mple-jooq/gensrc/main/java/sample/jooq/domain/Public.java
+65
-0
Tables.java
...mple-jooq/gensrc/main/java/sample/jooq/domain/Tables.java
+53
-0
Author.java
...oq/gensrc/main/java/sample/jooq/domain/tables/Author.java
+134
-0
Book.java
...jooq/gensrc/main/java/sample/jooq/domain/tables/Book.java
+137
-0
BookStore.java
...gensrc/main/java/sample/jooq/domain/tables/BookStore.java
+100
-0
BookToBookStore.java
.../main/java/sample/jooq/domain/tables/BookToBookStore.java
+127
-0
Language.java
.../gensrc/main/java/sample/jooq/domain/tables/Language.java
+118
-0
AuthorRecord.java
.../java/sample/jooq/domain/tables/records/AuthorRecord.java
+339
-0
BookRecord.java
...in/java/sample/jooq/domain/tables/records/BookRecord.java
+296
-0
BookStoreRecord.java
...va/sample/jooq/domain/tables/records/BookStoreRecord.java
+119
-0
BookToBookStoreRecord.java
...ple/jooq/domain/tables/records/BookToBookStoreRecord.java
+214
-0
LanguageRecord.java
...ava/sample/jooq/domain/tables/records/LanguageRecord.java
+214
-0
pom.xml
spring-boot-samples/spring-boot-sample-jooq/pom.xml
+171
-0
JooqExamples.java
...t-sample-jooq/src/main/java/sample/jooq/JooqExamples.java
+80
-0
SampleJooqApplication.java
...jooq/src/main/java/sample/jooq/SampleJooqApplication.java
+29
-0
data.sql
...mples/spring-boot-sample-jooq/src/main/resources/data.sql
+12
-0
reset.sql
...ples/spring-boot-sample-jooq/src/main/resources/reset.sql
+1
-0
schema.sql
...les/spring-boot-sample-jooq/src/main/resources/schema.sql
+39
-0
SampleJooqApplicationTests.java
...src/test/java/sample/jooq/SampleJooqApplicationTests.java
+46
-0
No files found.
spring-boot-samples/pom.xml
View file @
ab1cc829
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
<module>
spring-boot-sample-cache
</module>
<module>
spring-boot-sample-cache
</module>
<module>
spring-boot-sample-data-elasticsearch
</module>
<module>
spring-boot-sample-data-elasticsearch
</module>
<module>
spring-boot-sample-data-gemfire
</module>
<module>
spring-boot-sample-data-gemfire
</module>
<module>
spring-boot-sample-data-jooq
</module>
<module>
spring-boot-sample-data-jpa
</module>
<module>
spring-boot-sample-data-jpa
</module>
<module>
spring-boot-sample-data-mongodb
</module>
<module>
spring-boot-sample-data-mongodb
</module>
<module>
spring-boot-sample-data-redis
</module>
<module>
spring-boot-sample-data-redis
</module>
...
...
spring-boot-samples/spring-boot-sample-jooq/README.adoc
0 → 100644
View file @
ab1cc829
== jOOQ Sample
To rerun the code generator:
[indent=0]
----
$ rm -fr gensrc
$ mvn clean generate-sources -Pgenerate
----
spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Keys.java
0 → 100644
View file @
ab1cc829
/**
* This class is generated by jOOQ
*/
package
sample
.
jooq
.
domain
;
import
javax.annotation.Generated
;
import
org.jooq.ForeignKey
;
import
org.jooq.UniqueKey
;
import
org.jooq.impl.AbstractKeys
;
import
sample.jooq.domain.tables.Author
;
import
sample.jooq.domain.tables.Book
;
import
sample.jooq.domain.tables.BookStore
;
import
sample.jooq.domain.tables.BookToBookStore
;
import
sample.jooq.domain.tables.Language
;
import
sample.jooq.domain.tables.records.AuthorRecord
;
import
sample.jooq.domain.tables.records.BookRecord
;
import
sample.jooq.domain.tables.records.BookStoreRecord
;
import
sample.jooq.domain.tables.records.BookToBookStoreRecord
;
import
sample.jooq.domain.tables.records.LanguageRecord
;
/**
* A class modelling foreign key relationships between tables of the <code>PUBLIC</code>
* schema
*/
@Generated
(
value
=
{
"http://www.jooq.org"
,
"jOOQ version:3.6.2"
},
comments
=
"This class is generated by jOOQ"
)
@SuppressWarnings
({
"all"
,
"unchecked"
,
"rawtypes"
})
public
class
Keys
{
// -------------------------------------------------------------------------
// IDENTITY definitions
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
// UNIQUE and PRIMARY KEY definitions
// -------------------------------------------------------------------------
public
static
final
UniqueKey
<
LanguageRecord
>
CONSTRAINT_C
=
UniqueKeys0
.
CONSTRAINT_C
;
public
static
final
UniqueKey
<
AuthorRecord
>
CONSTRAINT_7
=
UniqueKeys0
.
CONSTRAINT_7
;
public
static
final
UniqueKey
<
BookRecord
>
CONSTRAINT_1
=
UniqueKeys0
.
CONSTRAINT_1
;
public
static
final
UniqueKey
<
BookStoreRecord
>
CONSTRAINT_F
=
UniqueKeys0
.
CONSTRAINT_F
;
public
static
final
UniqueKey
<
BookToBookStoreRecord
>
CONSTRAINT_2
=
UniqueKeys0
.
CONSTRAINT_2
;
// -------------------------------------------------------------------------
// FOREIGN KEY definitions
// -------------------------------------------------------------------------
public
static
final
ForeignKey
<
BookRecord
,
AuthorRecord
>
FK_BOOK_AUTHOR
=
ForeignKeys0
.
FK_BOOK_AUTHOR
;
public
static
final
ForeignKey
<
BookRecord
,
LanguageRecord
>
FK_BOOK_LANGUAGE
=
ForeignKeys0
.
FK_BOOK_LANGUAGE
;
public
static
final
ForeignKey
<
BookToBookStoreRecord
,
BookStoreRecord
>
FK_B2BS_BOOK_STORE
=
ForeignKeys0
.
FK_B2BS_BOOK_STORE
;
public
static
final
ForeignKey
<
BookToBookStoreRecord
,
BookRecord
>
FK_B2BS_BOOK
=
ForeignKeys0
.
FK_B2BS_BOOK
;
// -------------------------------------------------------------------------
// [#1459] distribute members to avoid static initialisers > 64kb
// -------------------------------------------------------------------------
private
static
class
UniqueKeys0
extends
AbstractKeys
{
public
static
final
UniqueKey
<
LanguageRecord
>
CONSTRAINT_C
=
createUniqueKey
(
Language
.
LANGUAGE
,
Language
.
LANGUAGE
.
ID
);
public
static
final
UniqueKey
<
AuthorRecord
>
CONSTRAINT_7
=
createUniqueKey
(
Author
.
AUTHOR
,
Author
.
AUTHOR
.
ID
);
public
static
final
UniqueKey
<
BookRecord
>
CONSTRAINT_1
=
createUniqueKey
(
Book
.
BOOK
,
Book
.
BOOK
.
ID
);
public
static
final
UniqueKey
<
BookStoreRecord
>
CONSTRAINT_F
=
createUniqueKey
(
BookStore
.
BOOK_STORE
,
BookStore
.
BOOK_STORE
.
NAME
);
public
static
final
UniqueKey
<
BookToBookStoreRecord
>
CONSTRAINT_2
=
createUniqueKey
(
BookToBookStore
.
BOOK_TO_BOOK_STORE
,
BookToBookStore
.
BOOK_TO_BOOK_STORE
.
NAME
,
BookToBookStore
.
BOOK_TO_BOOK_STORE
.
BOOK_ID
);
}
private
static
class
ForeignKeys0
extends
AbstractKeys
{
public
static
final
ForeignKey
<
BookRecord
,
AuthorRecord
>
FK_BOOK_AUTHOR
=
createForeignKey
(
sample
.
jooq
.
domain
.
Keys
.
CONSTRAINT_7
,
Book
.
BOOK
,
Book
.
BOOK
.
AUTHOR_ID
);
public
static
final
ForeignKey
<
BookRecord
,
LanguageRecord
>
FK_BOOK_LANGUAGE
=
createForeignKey
(
sample
.
jooq
.
domain
.
Keys
.
CONSTRAINT_C
,
Book
.
BOOK
,
Book
.
BOOK
.
LANGUAGE_ID
);
public
static
final
ForeignKey
<
BookToBookStoreRecord
,
BookStoreRecord
>
FK_B2BS_BOOK_STORE
=
createForeignKey
(
sample
.
jooq
.
domain
.
Keys
.
CONSTRAINT_F
,
BookToBookStore
.
BOOK_TO_BOOK_STORE
,
BookToBookStore
.
BOOK_TO_BOOK_STORE
.
NAME
);
public
static
final
ForeignKey
<
BookToBookStoreRecord
,
BookRecord
>
FK_B2BS_BOOK
=
createForeignKey
(
sample
.
jooq
.
domain
.
Keys
.
CONSTRAINT_1
,
BookToBookStore
.
BOOK_TO_BOOK_STORE
,
BookToBookStore
.
BOOK_TO_BOOK_STORE
.
BOOK_ID
);
}
}
spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Public.java
0 → 100644
View file @
ab1cc829
/**
* This class is generated by jOOQ
*/
package
sample
.
jooq
.
domain
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
javax.annotation.Generated
;
import
org.jooq.Table
;
import
org.jooq.impl.SchemaImpl
;
import
sample.jooq.domain.tables.Author
;
import
sample.jooq.domain.tables.Book
;
import
sample.jooq.domain.tables.BookStore
;
import
sample.jooq.domain.tables.BookToBookStore
;
import
sample.jooq.domain.tables.Language
;
/**
* This class is generated by jOOQ.
*/
@Generated
(
value
=
{
"http://www.jooq.org"
,
"jOOQ version:3.6.2"
},
comments
=
"This class is generated by jOOQ"
)
@SuppressWarnings
({
"all"
,
"unchecked"
,
"rawtypes"
})
public
class
Public
extends
SchemaImpl
{
private
static
final
long
serialVersionUID
=
1051839433
;
/**
* The reference instance of <code>PUBLIC</code>
*/
public
static
final
Public
PUBLIC
=
new
Public
();
/**
* No further instances allowed
*/
private
Public
()
{
super
(
"PUBLIC"
);
}
@Override
public
final
List
<
Table
<?>>
getTables
()
{
List
result
=
new
ArrayList
();
result
.
addAll
(
getTables0
());
return
result
;
}
private
final
List
<
Table
<?>>
getTables0
()
{
return
Arrays
.<
Table
<?>>
asList
(
Language
.
LANGUAGE
,
Author
.
AUTHOR
,
Book
.
BOOK
,
BookStore
.
BOOK_STORE
,
BookToBookStore
.
BOOK_TO_BOOK_STORE
);
}
}
spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Tables.java
0 → 100644
View file @
ab1cc829
/**
* This class is generated by jOOQ
*/
package
sample
.
jooq
.
domain
;
import
javax.annotation.Generated
;
import
sample.jooq.domain.tables.Author
;
import
sample.jooq.domain.tables.Book
;
import
sample.jooq.domain.tables.BookStore
;
import
sample.jooq.domain.tables.BookToBookStore
;
import
sample.jooq.domain.tables.Language
;
/**
* Convenience access to all tables in PUBLIC
*/
@Generated
(
value
=
{
"http://www.jooq.org"
,
"jOOQ version:3.6.2"
},
comments
=
"This class is generated by jOOQ"
)
@SuppressWarnings
({
"all"
,
"unchecked"
,
"rawtypes"
})
public
class
Tables
{
/**
* The table PUBLIC.LANGUAGE
*/
public
static
final
Language
LANGUAGE
=
sample
.
jooq
.
domain
.
tables
.
Language
.
LANGUAGE
;
/**
* The table PUBLIC.AUTHOR
*/
public
static
final
Author
AUTHOR
=
sample
.
jooq
.
domain
.
tables
.
Author
.
AUTHOR
;
/**
* The table PUBLIC.BOOK
*/
public
static
final
Book
BOOK
=
sample
.
jooq
.
domain
.
tables
.
Book
.
BOOK
;
/**
* The table PUBLIC.BOOK_STORE
*/
public
static
final
BookStore
BOOK_STORE
=
sample
.
jooq
.
domain
.
tables
.
BookStore
.
BOOK_STORE
;
/**
* The table PUBLIC.BOOK_TO_BOOK_STORE
*/
public
static
final
BookToBookStore
BOOK_TO_BOOK_STORE
=
sample
.
jooq
.
domain
.
tables
.
BookToBookStore
.
BOOK_TO_BOOK_STORE
;
}
spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Author.java
0 → 100644
View file @
ab1cc829
/**
* This class is generated by jOOQ
*/
package
sample
.
jooq
.
domain
.
tables
;
import
java.sql.Date
;
import
java.util.Arrays
;
import
java.util.List
;
import
javax.annotation.Generated
;
import
org.jooq.Field
;
import
org.jooq.Table
;
import
org.jooq.TableField
;
import
org.jooq.UniqueKey
;
import
org.jooq.impl.TableImpl
;
import
sample.jooq.domain.Keys
;
import
sample.jooq.domain.Public
;
import
sample.jooq.domain.tables.records.AuthorRecord
;
/**
* This class is generated by jOOQ.
*/
@Generated
(
value
=
{
"http://www.jooq.org"
,
"jOOQ version:3.6.2"
},
comments
=
"This class is generated by jOOQ"
)
@SuppressWarnings
({
"all"
,
"unchecked"
,
"rawtypes"
})
public
class
Author
extends
TableImpl
<
AuthorRecord
>
{
private
static
final
long
serialVersionUID
=
-
1989221607
;
/**
* The reference instance of <code>PUBLIC.AUTHOR</code>
*/
public
static
final
Author
AUTHOR
=
new
Author
();
/**
* The class holding records for this type
*/
@Override
public
Class
<
AuthorRecord
>
getRecordType
()
{
return
AuthorRecord
.
class
;
}
/**
* The column <code>PUBLIC.AUTHOR.ID</code>.
*/
public
final
TableField
<
AuthorRecord
,
Integer
>
ID
=
createField
(
"ID"
,
org
.
jooq
.
impl
.
SQLDataType
.
INTEGER
.
nullable
(
false
),
this
,
""
);
/**
* The column <code>PUBLIC.AUTHOR.FIRST_NAME</code>.
*/
public
final
TableField
<
AuthorRecord
,
String
>
FIRST_NAME
=
createField
(
"FIRST_NAME"
,
org
.
jooq
.
impl
.
SQLDataType
.
VARCHAR
.
length
(
50
),
this
,
""
);
/**
* The column <code>PUBLIC.AUTHOR.LAST_NAME</code>.
*/
public
final
TableField
<
AuthorRecord
,
String
>
LAST_NAME
=
createField
(
"LAST_NAME"
,
org
.
jooq
.
impl
.
SQLDataType
.
VARCHAR
.
length
(
50
).
nullable
(
false
),
this
,
""
);
/**
* The column <code>PUBLIC.AUTHOR.DATE_OF_BIRTH</code>.
*/
public
final
TableField
<
AuthorRecord
,
Date
>
DATE_OF_BIRTH
=
createField
(
"DATE_OF_BIRTH"
,
org
.
jooq
.
impl
.
SQLDataType
.
DATE
,
this
,
""
);
/**
* The column <code>PUBLIC.AUTHOR.YEAR_OF_BIRTH</code>.
*/
public
final
TableField
<
AuthorRecord
,
Integer
>
YEAR_OF_BIRTH
=
createField
(
"YEAR_OF_BIRTH"
,
org
.
jooq
.
impl
.
SQLDataType
.
INTEGER
,
this
,
""
);
/**
* The column <code>PUBLIC.AUTHOR.DISTINGUISHED</code>.
*/
public
final
TableField
<
AuthorRecord
,
Byte
>
DISTINGUISHED
=
createField
(
"DISTINGUISHED"
,
org
.
jooq
.
impl
.
SQLDataType
.
TINYINT
,
this
,
""
);
/**
* Create a <code>PUBLIC.AUTHOR</code> table reference
*/
public
Author
()
{
this
(
"AUTHOR"
,
null
);
}
/**
* Create an aliased <code>PUBLIC.AUTHOR</code> table reference
*/
public
Author
(
String
alias
)
{
this
(
alias
,
AUTHOR
);
}
private
Author
(
String
alias
,
Table
<
AuthorRecord
>
aliased
)
{
this
(
alias
,
aliased
,
null
);
}
private
Author
(
String
alias
,
Table
<
AuthorRecord
>
aliased
,
Field
<?>[]
parameters
)
{
super
(
alias
,
Public
.
PUBLIC
,
aliased
,
parameters
,
""
);
}
/**
* {@inheritDoc}
*/
@Override
public
UniqueKey
<
AuthorRecord
>
getPrimaryKey
()
{
return
Keys
.
CONSTRAINT_7
;
}
/**
* {@inheritDoc}
*/
@Override
public
List
<
UniqueKey
<
AuthorRecord
>>
getKeys
()
{
return
Arrays
.<
UniqueKey
<
AuthorRecord
>>
asList
(
Keys
.
CONSTRAINT_7
);
}
/**
* {@inheritDoc}
*/
@Override
public
Author
as
(
String
alias
)
{
return
new
Author
(
alias
,
this
);
}
/**
* Rename this table
*/
public
Author
rename
(
String
name
)
{
return
new
Author
(
name
,
null
);
}
}
spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Book.java
0 → 100644
View file @
ab1cc829
/**
* This class is generated by jOOQ
*/
package
sample
.
jooq
.
domain
.
tables
;
import
java.util.Arrays
;
import
java.util.List
;
import
javax.annotation.Generated
;
import
org.jooq.Field
;
import
org.jooq.ForeignKey
;
import
org.jooq.Table
;
import
org.jooq.TableField
;
import
org.jooq.UniqueKey
;
import
org.jooq.impl.TableImpl
;
import
sample.jooq.domain.Keys
;
import
sample.jooq.domain.Public
;
import
sample.jooq.domain.tables.records.BookRecord
;
/**
* This class is generated by jOOQ.
*/
@Generated
(
value
=
{
"http://www.jooq.org"
,
"jOOQ version:3.6.2"
},
comments
=
"This class is generated by jOOQ"
)
@SuppressWarnings
({
"all"
,
"unchecked"
,
"rawtypes"
})
public
class
Book
extends
TableImpl
<
BookRecord
>
{
private
static
final
long
serialVersionUID
=
1858247563
;
/**
* The reference instance of <code>PUBLIC.BOOK</code>
*/
public
static
final
Book
BOOK
=
new
Book
();
/**
* The class holding records for this type
*/
@Override
public
Class
<
BookRecord
>
getRecordType
()
{
return
BookRecord
.
class
;
}
/**
* The column <code>PUBLIC.BOOK.ID</code>.
*/
public
final
TableField
<
BookRecord
,
Integer
>
ID
=
createField
(
"ID"
,
org
.
jooq
.
impl
.
SQLDataType
.
INTEGER
.
nullable
(
false
),
this
,
""
);
/**
* The column <code>PUBLIC.BOOK.AUTHOR_ID</code>.
*/
public
final
TableField
<
BookRecord
,
Integer
>
AUTHOR_ID
=
createField
(
"AUTHOR_ID"
,
org
.
jooq
.
impl
.
SQLDataType
.
INTEGER
.
nullable
(
false
),
this
,
""
);
/**
* The column <code>PUBLIC.BOOK.TITLE</code>.
*/
public
final
TableField
<
BookRecord
,
String
>
TITLE
=
createField
(
"TITLE"
,
org
.
jooq
.
impl
.
SQLDataType
.
VARCHAR
.
length
(
400
).
nullable
(
false
),
this
,
""
);
/**
* The column <code>PUBLIC.BOOK.PUBLISHED_IN</code>.
*/
public
final
TableField
<
BookRecord
,
Integer
>
PUBLISHED_IN
=
createField
(
"PUBLISHED_IN"
,
org
.
jooq
.
impl
.
SQLDataType
.
INTEGER
.
nullable
(
false
),
this
,
""
);
/**
* The column <code>PUBLIC.BOOK.LANGUAGE_ID</code>.
*/
public
final
TableField
<
BookRecord
,
Integer
>
LANGUAGE_ID
=
createField
(
"LANGUAGE_ID"
,
org
.
jooq
.
impl
.
SQLDataType
.
INTEGER
.
nullable
(
false
),
this
,
""
);
/**
* Create a <code>PUBLIC.BOOK</code> table reference
*/
public
Book
()
{
this
(
"BOOK"
,
null
);
}
/**
* Create an aliased <code>PUBLIC.BOOK</code> table reference
*/
public
Book
(
String
alias
)
{
this
(
alias
,
BOOK
);
}
private
Book
(
String
alias
,
Table
<
BookRecord
>
aliased
)
{
this
(
alias
,
aliased
,
null
);
}
private
Book
(
String
alias
,
Table
<
BookRecord
>
aliased
,
Field
<?>[]
parameters
)
{
super
(
alias
,
Public
.
PUBLIC
,
aliased
,
parameters
,
""
);
}
/**
* {@inheritDoc}
*/
@Override
public
UniqueKey
<
BookRecord
>
getPrimaryKey
()
{
return
Keys
.
CONSTRAINT_1
;
}
/**
* {@inheritDoc}
*/
@Override
public
List
<
UniqueKey
<
BookRecord
>>
getKeys
()
{
return
Arrays
.<
UniqueKey
<
BookRecord
>>
asList
(
Keys
.
CONSTRAINT_1
);
}
/**
* {@inheritDoc}
*/
@Override
public
List
<
ForeignKey
<
BookRecord
,
?>>
getReferences
()
{
return
Arrays
.<
ForeignKey
<
BookRecord
,
?>>
asList
(
Keys
.
FK_BOOK_AUTHOR
,
Keys
.
FK_BOOK_LANGUAGE
);
}
/**
* {@inheritDoc}
*/
@Override
public
Book
as
(
String
alias
)
{
return
new
Book
(
alias
,
this
);
}
/**
* Rename this table
*/
public
Book
rename
(
String
name
)
{
return
new
Book
(
name
,
null
);
}
}
spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/BookStore.java
0 → 100644
View file @
ab1cc829
/**
* This class is generated by jOOQ
*/
package
sample
.
jooq
.
domain
.
tables
;
import
java.util.Arrays
;
import
java.util.List
;
import
javax.annotation.Generated
;
import
org.jooq.Field
;
import
org.jooq.Table
;
import
org.jooq.TableField
;
import
org.jooq.UniqueKey
;
import
org.jooq.impl.TableImpl
;
import
sample.jooq.domain.Keys
;
import
sample.jooq.domain.Public
;
import
sample.jooq.domain.tables.records.BookStoreRecord
;
/**
* This class is generated by jOOQ.
*/
@Generated
(
value
=
{
"http://www.jooq.org"
,
"jOOQ version:3.6.2"
},
comments
=
"This class is generated by jOOQ"
)
@SuppressWarnings
({
"all"
,
"unchecked"
,
"rawtypes"
})
public
class
BookStore
extends
TableImpl
<
BookStoreRecord
>
{
private
static
final
long
serialVersionUID
=
1437758195
;
/**
* The reference instance of <code>PUBLIC.BOOK_STORE</code>
*/
public
static
final
BookStore
BOOK_STORE
=
new
BookStore
();
/**
* The class holding records for this type
*/
@Override
public
Class
<
BookStoreRecord
>
getRecordType
()
{
return
BookStoreRecord
.
class
;
}
/**
* The column <code>PUBLIC.BOOK_STORE.NAME</code>.
*/
public
final
TableField
<
BookStoreRecord
,
String
>
NAME
=
createField
(
"NAME"
,
org
.
jooq
.
impl
.
SQLDataType
.
VARCHAR
.
length
(
400
).
nullable
(
false
),
this
,
""
);
/**
* Create a <code>PUBLIC.BOOK_STORE</code> table reference
*/
public
BookStore
()
{
this
(
"BOOK_STORE"
,
null
);
}
/**
* Create an aliased <code>PUBLIC.BOOK_STORE</code> table reference
*/
public
BookStore
(
String
alias
)
{
this
(
alias
,
BOOK_STORE
);
}
private
BookStore
(
String
alias
,
Table
<
BookStoreRecord
>
aliased
)
{
this
(
alias
,
aliased
,
null
);
}
private
BookStore
(
String
alias
,
Table
<
BookStoreRecord
>
aliased
,
Field
<?>[]
parameters
)
{
super
(
alias
,
Public
.
PUBLIC
,
aliased
,
parameters
,
""
);
}
/**
* {@inheritDoc}
*/
@Override
public
List
<
UniqueKey
<
BookStoreRecord
>>
getKeys
()
{
return
Arrays
.<
UniqueKey
<
BookStoreRecord
>>
asList
(
Keys
.
CONSTRAINT_F
);
}
/**
* {@inheritDoc}
*/
@Override
public
BookStore
as
(
String
alias
)
{
return
new
BookStore
(
alias
,
this
);
}
/**
* Rename this table
*/
public
BookStore
rename
(
String
name
)
{
return
new
BookStore
(
name
,
null
);
}
}
spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/BookToBookStore.java
0 → 100644
View file @
ab1cc829
/**
* This class is generated by jOOQ
*/
package
sample
.
jooq
.
domain
.
tables
;
import
java.util.Arrays
;
import
java.util.List
;
import
javax.annotation.Generated
;
import
org.jooq.Field
;
import
org.jooq.ForeignKey
;
import
org.jooq.Table
;
import
org.jooq.TableField
;
import
org.jooq.UniqueKey
;
import
org.jooq.impl.TableImpl
;
import
sample.jooq.domain.Keys
;
import
sample.jooq.domain.Public
;
import
sample.jooq.domain.tables.records.BookToBookStoreRecord
;
/**
* This class is generated by jOOQ.
*/
@Generated
(
value
=
{
"http://www.jooq.org"
,
"jOOQ version:3.6.2"
},
comments
=
"This class is generated by jOOQ"
)
@SuppressWarnings
({
"all"
,
"unchecked"
,
"rawtypes"
})
public
class
BookToBookStore
extends
TableImpl
<
BookToBookStoreRecord
>
{
private
static
final
long
serialVersionUID
=
-
557222072
;
/**
* The reference instance of <code>PUBLIC.BOOK_TO_BOOK_STORE</code>
*/
public
static
final
BookToBookStore
BOOK_TO_BOOK_STORE
=
new
BookToBookStore
();
/**
* The class holding records for this type
*/
@Override
public
Class
<
BookToBookStoreRecord
>
getRecordType
()
{
return
BookToBookStoreRecord
.
class
;
}
/**
* The column <code>PUBLIC.BOOK_TO_BOOK_STORE.NAME</code>.
*/
public
final
TableField
<
BookToBookStoreRecord
,
String
>
NAME
=
createField
(
"NAME"
,
org
.
jooq
.
impl
.
SQLDataType
.
VARCHAR
.
length
(
400
).
nullable
(
false
),
this
,
""
);
/**
* The column <code>PUBLIC.BOOK_TO_BOOK_STORE.BOOK_ID</code>.
*/
public
final
TableField
<
BookToBookStoreRecord
,
Integer
>
BOOK_ID
=
createField
(
"BOOK_ID"
,
org
.
jooq
.
impl
.
SQLDataType
.
INTEGER
.
nullable
(
false
),
this
,
""
);
/**
* The column <code>PUBLIC.BOOK_TO_BOOK_STORE.STOCK</code>.
*/
public
final
TableField
<
BookToBookStoreRecord
,
Integer
>
STOCK
=
createField
(
"STOCK"
,
org
.
jooq
.
impl
.
SQLDataType
.
INTEGER
,
this
,
""
);
/**
* Create a <code>PUBLIC.BOOK_TO_BOOK_STORE</code> table reference
*/
public
BookToBookStore
()
{
this
(
"BOOK_TO_BOOK_STORE"
,
null
);
}
/**
* Create an aliased <code>PUBLIC.BOOK_TO_BOOK_STORE</code> table reference
*/
public
BookToBookStore
(
String
alias
)
{
this
(
alias
,
BOOK_TO_BOOK_STORE
);
}
private
BookToBookStore
(
String
alias
,
Table
<
BookToBookStoreRecord
>
aliased
)
{
this
(
alias
,
aliased
,
null
);
}
private
BookToBookStore
(
String
alias
,
Table
<
BookToBookStoreRecord
>
aliased
,
Field
<?>[]
parameters
)
{
super
(
alias
,
Public
.
PUBLIC
,
aliased
,
parameters
,
""
);
}
/**
* {@inheritDoc}
*/
@Override
public
UniqueKey
<
BookToBookStoreRecord
>
getPrimaryKey
()
{
return
Keys
.
CONSTRAINT_2
;
}
/**
* {@inheritDoc}
*/
@Override
public
List
<
UniqueKey
<
BookToBookStoreRecord
>>
getKeys
()
{
return
Arrays
.<
UniqueKey
<
BookToBookStoreRecord
>>
asList
(
Keys
.
CONSTRAINT_2
);
}
/**
* {@inheritDoc}
*/
@Override
public
List
<
ForeignKey
<
BookToBookStoreRecord
,
?>>
getReferences
()
{
return
Arrays
.<
ForeignKey
<
BookToBookStoreRecord
,
?>>
asList
(
Keys
.
FK_B2BS_BOOK_STORE
,
Keys
.
FK_B2BS_BOOK
);
}
/**
* {@inheritDoc}
*/
@Override
public
BookToBookStore
as
(
String
alias
)
{
return
new
BookToBookStore
(
alias
,
this
);
}
/**
* Rename this table
*/
public
BookToBookStore
rename
(
String
name
)
{
return
new
BookToBookStore
(
name
,
null
);
}
}
spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Language.java
0 → 100644
View file @
ab1cc829
/**
* This class is generated by jOOQ
*/
package
sample
.
jooq
.
domain
.
tables
;
import
java.util.Arrays
;
import
java.util.List
;
import
javax.annotation.Generated
;
import
org.jooq.Field
;
import
org.jooq.Table
;
import
org.jooq.TableField
;
import
org.jooq.UniqueKey
;
import
org.jooq.impl.TableImpl
;
import
sample.jooq.domain.Keys
;
import
sample.jooq.domain.Public
;
import
sample.jooq.domain.tables.records.LanguageRecord
;
/**
* This class is generated by jOOQ.
*/
@Generated
(
value
=
{
"http://www.jooq.org"
,
"jOOQ version:3.6.2"
},
comments
=
"This class is generated by jOOQ"
)
@SuppressWarnings
({
"all"
,
"unchecked"
,
"rawtypes"
})
public
class
Language
extends
TableImpl
<
LanguageRecord
>
{
private
static
final
long
serialVersionUID
=
-
192479483
;
/**
* The reference instance of <code>PUBLIC.LANGUAGE</code>
*/
public
static
final
Language
LANGUAGE
=
new
Language
();
/**
* The class holding records for this type
*/
@Override
public
Class
<
LanguageRecord
>
getRecordType
()
{
return
LanguageRecord
.
class
;
}
/**
* The column <code>PUBLIC.LANGUAGE.ID</code>.
*/
public
final
TableField
<
LanguageRecord
,
Integer
>
ID
=
createField
(
"ID"
,
org
.
jooq
.
impl
.
SQLDataType
.
INTEGER
.
nullable
(
false
),
this
,
""
);
/**
* The column <code>PUBLIC.LANGUAGE.CD</code>.
*/
public
final
TableField
<
LanguageRecord
,
String
>
CD
=
createField
(
"CD"
,
org
.
jooq
.
impl
.
SQLDataType
.
CHAR
.
length
(
2
).
nullable
(
false
),
this
,
""
);
/**
* The column <code>PUBLIC.LANGUAGE.DESCRIPTION</code>.
*/
public
final
TableField
<
LanguageRecord
,
String
>
DESCRIPTION
=
createField
(
"DESCRIPTION"
,
org
.
jooq
.
impl
.
SQLDataType
.
VARCHAR
.
length
(
50
),
this
,
""
);
/**
* Create a <code>PUBLIC.LANGUAGE</code> table reference
*/
public
Language
()
{
this
(
"LANGUAGE"
,
null
);
}
/**
* Create an aliased <code>PUBLIC.LANGUAGE</code> table reference
*/
public
Language
(
String
alias
)
{
this
(
alias
,
LANGUAGE
);
}
private
Language
(
String
alias
,
Table
<
LanguageRecord
>
aliased
)
{
this
(
alias
,
aliased
,
null
);
}
private
Language
(
String
alias
,
Table
<
LanguageRecord
>
aliased
,
Field
<?>[]
parameters
)
{
super
(
alias
,
Public
.
PUBLIC
,
aliased
,
parameters
,
""
);
}
/**
* {@inheritDoc}
*/
@Override
public
UniqueKey
<
LanguageRecord
>
getPrimaryKey
()
{
return
Keys
.
CONSTRAINT_C
;
}
/**
* {@inheritDoc}
*/
@Override
public
List
<
UniqueKey
<
LanguageRecord
>>
getKeys
()
{
return
Arrays
.<
UniqueKey
<
LanguageRecord
>>
asList
(
Keys
.
CONSTRAINT_C
);
}
/**
* {@inheritDoc}
*/
@Override
public
Language
as
(
String
alias
)
{
return
new
Language
(
alias
,
this
);
}
/**
* Rename this table
*/
public
Language
rename
(
String
name
)
{
return
new
Language
(
name
,
null
);
}
}
spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/AuthorRecord.java
0 → 100644
View file @
ab1cc829
/**
* This class is generated by jOOQ
*/
package
sample
.
jooq
.
domain
.
tables
.
records
;
import
java.sql.Date
;
import
javax.annotation.Generated
;
import
org.jooq.Field
;
import
org.jooq.Record1
;
import
org.jooq.Record6
;
import
org.jooq.Row6
;
import
org.jooq.impl.UpdatableRecordImpl
;
import
sample.jooq.domain.tables.Author
;
/**
* This class is generated by jOOQ.
*/
@Generated
(
value
=
{
"http://www.jooq.org"
,
"jOOQ version:3.6.2"
},
comments
=
"This class is generated by jOOQ"
)
@SuppressWarnings
({
"all"
,
"unchecked"
,
"rawtypes"
})
public
class
AuthorRecord
extends
UpdatableRecordImpl
<
AuthorRecord
>
implements
Record6
<
Integer
,
String
,
String
,
Date
,
Integer
,
Byte
>
{
private
static
final
long
serialVersionUID
=
-
983051550
;
/**
* Setter for <code>PUBLIC.AUTHOR.ID</code>.
*/
public
void
setId
(
Integer
value
)
{
setValue
(
0
,
value
);
}
/**
* Getter for <code>PUBLIC.AUTHOR.ID</code>.
*/
public
Integer
getId
()
{
return
(
Integer
)
getValue
(
0
);
}
/**
* Setter for <code>PUBLIC.AUTHOR.FIRST_NAME</code>.
*/
public
void
setFirstName
(
String
value
)
{
setValue
(
1
,
value
);
}
/**
* Getter for <code>PUBLIC.AUTHOR.FIRST_NAME</code>.
*/
public
String
getFirstName
()
{
return
(
String
)
getValue
(
1
);
}
/**
* Setter for <code>PUBLIC.AUTHOR.LAST_NAME</code>.
*/
public
void
setLastName
(
String
value
)
{
setValue
(
2
,
value
);
}
/**
* Getter for <code>PUBLIC.AUTHOR.LAST_NAME</code>.
*/
public
String
getLastName
()
{
return
(
String
)
getValue
(
2
);
}
/**
* Setter for <code>PUBLIC.AUTHOR.DATE_OF_BIRTH</code>.
*/
public
void
setDateOfBirth
(
Date
value
)
{
setValue
(
3
,
value
);
}
/**
* Getter for <code>PUBLIC.AUTHOR.DATE_OF_BIRTH</code>.
*/
public
Date
getDateOfBirth
()
{
return
(
Date
)
getValue
(
3
);
}
/**
* Setter for <code>PUBLIC.AUTHOR.YEAR_OF_BIRTH</code>.
*/
public
void
setYearOfBirth
(
Integer
value
)
{
setValue
(
4
,
value
);
}
/**
* Getter for <code>PUBLIC.AUTHOR.YEAR_OF_BIRTH</code>.
*/
public
Integer
getYearOfBirth
()
{
return
(
Integer
)
getValue
(
4
);
}
/**
* Setter for <code>PUBLIC.AUTHOR.DISTINGUISHED</code>.
*/
public
void
setDistinguished
(
Byte
value
)
{
setValue
(
5
,
value
);
}
/**
* Getter for <code>PUBLIC.AUTHOR.DISTINGUISHED</code>.
*/
public
Byte
getDistinguished
()
{
return
(
Byte
)
getValue
(
5
);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public
Record1
<
Integer
>
key
()
{
return
(
Record1
)
super
.
key
();
}
// -------------------------------------------------------------------------
// Record6 type implementation
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public
Row6
<
Integer
,
String
,
String
,
Date
,
Integer
,
Byte
>
fieldsRow
()
{
return
(
Row6
)
super
.
fieldsRow
();
}
/**
* {@inheritDoc}
*/
@Override
public
Row6
<
Integer
,
String
,
String
,
Date
,
Integer
,
Byte
>
valuesRow
()
{
return
(
Row6
)
super
.
valuesRow
();
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
Integer
>
field1
()
{
return
Author
.
AUTHOR
.
ID
;
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
String
>
field2
()
{
return
Author
.
AUTHOR
.
FIRST_NAME
;
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
String
>
field3
()
{
return
Author
.
AUTHOR
.
LAST_NAME
;
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
Date
>
field4
()
{
return
Author
.
AUTHOR
.
DATE_OF_BIRTH
;
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
Integer
>
field5
()
{
return
Author
.
AUTHOR
.
YEAR_OF_BIRTH
;
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
Byte
>
field6
()
{
return
Author
.
AUTHOR
.
DISTINGUISHED
;
}
/**
* {@inheritDoc}
*/
@Override
public
Integer
value1
()
{
return
getId
();
}
/**
* {@inheritDoc}
*/
@Override
public
String
value2
()
{
return
getFirstName
();
}
/**
* {@inheritDoc}
*/
@Override
public
String
value3
()
{
return
getLastName
();
}
/**
* {@inheritDoc}
*/
@Override
public
Date
value4
()
{
return
getDateOfBirth
();
}
/**
* {@inheritDoc}
*/
@Override
public
Integer
value5
()
{
return
getYearOfBirth
();
}
/**
* {@inheritDoc}
*/
@Override
public
Byte
value6
()
{
return
getDistinguished
();
}
/**
* {@inheritDoc}
*/
@Override
public
AuthorRecord
value1
(
Integer
value
)
{
setId
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
AuthorRecord
value2
(
String
value
)
{
setFirstName
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
AuthorRecord
value3
(
String
value
)
{
setLastName
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
AuthorRecord
value4
(
Date
value
)
{
setDateOfBirth
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
AuthorRecord
value5
(
Integer
value
)
{
setYearOfBirth
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
AuthorRecord
value6
(
Byte
value
)
{
setDistinguished
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
AuthorRecord
values
(
Integer
value1
,
String
value2
,
String
value3
,
Date
value4
,
Integer
value5
,
Byte
value6
)
{
value1
(
value1
);
value2
(
value2
);
value3
(
value3
);
value4
(
value4
);
value5
(
value5
);
value6
(
value6
);
return
this
;
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* Create a detached AuthorRecord
*/
public
AuthorRecord
()
{
super
(
Author
.
AUTHOR
);
}
/**
* Create a detached, initialised AuthorRecord
*/
public
AuthorRecord
(
Integer
id
,
String
firstName
,
String
lastName
,
Date
dateOfBirth
,
Integer
yearOfBirth
,
Byte
distinguished
)
{
super
(
Author
.
AUTHOR
);
setValue
(
0
,
id
);
setValue
(
1
,
firstName
);
setValue
(
2
,
lastName
);
setValue
(
3
,
dateOfBirth
);
setValue
(
4
,
yearOfBirth
);
setValue
(
5
,
distinguished
);
}
}
spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookRecord.java
0 → 100644
View file @
ab1cc829
/**
* This class is generated by jOOQ
*/
package
sample
.
jooq
.
domain
.
tables
.
records
;
import
javax.annotation.Generated
;
import
org.jooq.Field
;
import
org.jooq.Record1
;
import
org.jooq.Record5
;
import
org.jooq.Row5
;
import
org.jooq.impl.UpdatableRecordImpl
;
import
sample.jooq.domain.tables.Book
;
/**
* This class is generated by jOOQ.
*/
@Generated
(
value
=
{
"http://www.jooq.org"
,
"jOOQ version:3.6.2"
},
comments
=
"This class is generated by jOOQ"
)
@SuppressWarnings
({
"all"
,
"unchecked"
,
"rawtypes"
})
public
class
BookRecord
extends
UpdatableRecordImpl
<
BookRecord
>
implements
Record5
<
Integer
,
Integer
,
String
,
Integer
,
Integer
>
{
private
static
final
long
serialVersionUID
=
220424682
;
/**
* Setter for <code>PUBLIC.BOOK.ID</code>.
*/
public
void
setId
(
Integer
value
)
{
setValue
(
0
,
value
);
}
/**
* Getter for <code>PUBLIC.BOOK.ID</code>.
*/
public
Integer
getId
()
{
return
(
Integer
)
getValue
(
0
);
}
/**
* Setter for <code>PUBLIC.BOOK.AUTHOR_ID</code>.
*/
public
void
setAuthorId
(
Integer
value
)
{
setValue
(
1
,
value
);
}
/**
* Getter for <code>PUBLIC.BOOK.AUTHOR_ID</code>.
*/
public
Integer
getAuthorId
()
{
return
(
Integer
)
getValue
(
1
);
}
/**
* Setter for <code>PUBLIC.BOOK.TITLE</code>.
*/
public
void
setTitle
(
String
value
)
{
setValue
(
2
,
value
);
}
/**
* Getter for <code>PUBLIC.BOOK.TITLE</code>.
*/
public
String
getTitle
()
{
return
(
String
)
getValue
(
2
);
}
/**
* Setter for <code>PUBLIC.BOOK.PUBLISHED_IN</code>.
*/
public
void
setPublishedIn
(
Integer
value
)
{
setValue
(
3
,
value
);
}
/**
* Getter for <code>PUBLIC.BOOK.PUBLISHED_IN</code>.
*/
public
Integer
getPublishedIn
()
{
return
(
Integer
)
getValue
(
3
);
}
/**
* Setter for <code>PUBLIC.BOOK.LANGUAGE_ID</code>.
*/
public
void
setLanguageId
(
Integer
value
)
{
setValue
(
4
,
value
);
}
/**
* Getter for <code>PUBLIC.BOOK.LANGUAGE_ID</code>.
*/
public
Integer
getLanguageId
()
{
return
(
Integer
)
getValue
(
4
);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public
Record1
<
Integer
>
key
()
{
return
(
Record1
)
super
.
key
();
}
// -------------------------------------------------------------------------
// Record5 type implementation
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public
Row5
<
Integer
,
Integer
,
String
,
Integer
,
Integer
>
fieldsRow
()
{
return
(
Row5
)
super
.
fieldsRow
();
}
/**
* {@inheritDoc}
*/
@Override
public
Row5
<
Integer
,
Integer
,
String
,
Integer
,
Integer
>
valuesRow
()
{
return
(
Row5
)
super
.
valuesRow
();
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
Integer
>
field1
()
{
return
Book
.
BOOK
.
ID
;
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
Integer
>
field2
()
{
return
Book
.
BOOK
.
AUTHOR_ID
;
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
String
>
field3
()
{
return
Book
.
BOOK
.
TITLE
;
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
Integer
>
field4
()
{
return
Book
.
BOOK
.
PUBLISHED_IN
;
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
Integer
>
field5
()
{
return
Book
.
BOOK
.
LANGUAGE_ID
;
}
/**
* {@inheritDoc}
*/
@Override
public
Integer
value1
()
{
return
getId
();
}
/**
* {@inheritDoc}
*/
@Override
public
Integer
value2
()
{
return
getAuthorId
();
}
/**
* {@inheritDoc}
*/
@Override
public
String
value3
()
{
return
getTitle
();
}
/**
* {@inheritDoc}
*/
@Override
public
Integer
value4
()
{
return
getPublishedIn
();
}
/**
* {@inheritDoc}
*/
@Override
public
Integer
value5
()
{
return
getLanguageId
();
}
/**
* {@inheritDoc}
*/
@Override
public
BookRecord
value1
(
Integer
value
)
{
setId
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
BookRecord
value2
(
Integer
value
)
{
setAuthorId
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
BookRecord
value3
(
String
value
)
{
setTitle
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
BookRecord
value4
(
Integer
value
)
{
setPublishedIn
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
BookRecord
value5
(
Integer
value
)
{
setLanguageId
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
BookRecord
values
(
Integer
value1
,
Integer
value2
,
String
value3
,
Integer
value4
,
Integer
value5
)
{
value1
(
value1
);
value2
(
value2
);
value3
(
value3
);
value4
(
value4
);
value5
(
value5
);
return
this
;
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* Create a detached BookRecord
*/
public
BookRecord
()
{
super
(
Book
.
BOOK
);
}
/**
* Create a detached, initialised BookRecord
*/
public
BookRecord
(
Integer
id
,
Integer
authorId
,
String
title
,
Integer
publishedIn
,
Integer
languageId
)
{
super
(
Book
.
BOOK
);
setValue
(
0
,
id
);
setValue
(
1
,
authorId
);
setValue
(
2
,
title
);
setValue
(
3
,
publishedIn
);
setValue
(
4
,
languageId
);
}
}
spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookStoreRecord.java
0 → 100644
View file @
ab1cc829
/**
* This class is generated by jOOQ
*/
package
sample
.
jooq
.
domain
.
tables
.
records
;
import
javax.annotation.Generated
;
import
org.jooq.Field
;
import
org.jooq.Record1
;
import
org.jooq.Row1
;
import
org.jooq.impl.TableRecordImpl
;
import
sample.jooq.domain.tables.BookStore
;
/**
* This class is generated by jOOQ.
*/
@Generated
(
value
=
{
"http://www.jooq.org"
,
"jOOQ version:3.6.2"
},
comments
=
"This class is generated by jOOQ"
)
@SuppressWarnings
({
"all"
,
"unchecked"
,
"rawtypes"
})
public
class
BookStoreRecord
extends
TableRecordImpl
<
BookStoreRecord
>
implements
Record1
<
String
>
{
private
static
final
long
serialVersionUID
=
-
1969224219
;
/**
* Setter for <code>PUBLIC.BOOK_STORE.NAME</code>.
*/
public
void
setName
(
String
value
)
{
setValue
(
0
,
value
);
}
/**
* Getter for <code>PUBLIC.BOOK_STORE.NAME</code>.
*/
public
String
getName
()
{
return
(
String
)
getValue
(
0
);
}
// -------------------------------------------------------------------------
// Record1 type implementation
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public
Row1
<
String
>
fieldsRow
()
{
return
(
Row1
)
super
.
fieldsRow
();
}
/**
* {@inheritDoc}
*/
@Override
public
Row1
<
String
>
valuesRow
()
{
return
(
Row1
)
super
.
valuesRow
();
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
String
>
field1
()
{
return
BookStore
.
BOOK_STORE
.
NAME
;
}
/**
* {@inheritDoc}
*/
@Override
public
String
value1
()
{
return
getName
();
}
/**
* {@inheritDoc}
*/
@Override
public
BookStoreRecord
value1
(
String
value
)
{
setName
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
BookStoreRecord
values
(
String
value1
)
{
value1
(
value1
);
return
this
;
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* Create a detached BookStoreRecord
*/
public
BookStoreRecord
()
{
super
(
BookStore
.
BOOK_STORE
);
}
/**
* Create a detached, initialised BookStoreRecord
*/
public
BookStoreRecord
(
String
name
)
{
super
(
BookStore
.
BOOK_STORE
);
setValue
(
0
,
name
);
}
}
spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookToBookStoreRecord.java
0 → 100644
View file @
ab1cc829
/**
* This class is generated by jOOQ
*/
package
sample
.
jooq
.
domain
.
tables
.
records
;
import
javax.annotation.Generated
;
import
org.jooq.Field
;
import
org.jooq.Record2
;
import
org.jooq.Record3
;
import
org.jooq.Row3
;
import
org.jooq.impl.UpdatableRecordImpl
;
import
sample.jooq.domain.tables.BookToBookStore
;
/**
* This class is generated by jOOQ.
*/
@Generated
(
value
=
{
"http://www.jooq.org"
,
"jOOQ version:3.6.2"
},
comments
=
"This class is generated by jOOQ"
)
@SuppressWarnings
({
"all"
,
"unchecked"
,
"rawtypes"
})
public
class
BookToBookStoreRecord
extends
UpdatableRecordImpl
<
BookToBookStoreRecord
>
implements
Record3
<
String
,
Integer
,
Integer
>
{
private
static
final
long
serialVersionUID
=
1124329527
;
/**
* Setter for <code>PUBLIC.BOOK_TO_BOOK_STORE.NAME</code>.
*/
public
void
setName
(
String
value
)
{
setValue
(
0
,
value
);
}
/**
* Getter for <code>PUBLIC.BOOK_TO_BOOK_STORE.NAME</code>.
*/
public
String
getName
()
{
return
(
String
)
getValue
(
0
);
}
/**
* Setter for <code>PUBLIC.BOOK_TO_BOOK_STORE.BOOK_ID</code>.
*/
public
void
setBookId
(
Integer
value
)
{
setValue
(
1
,
value
);
}
/**
* Getter for <code>PUBLIC.BOOK_TO_BOOK_STORE.BOOK_ID</code>.
*/
public
Integer
getBookId
()
{
return
(
Integer
)
getValue
(
1
);
}
/**
* Setter for <code>PUBLIC.BOOK_TO_BOOK_STORE.STOCK</code>.
*/
public
void
setStock
(
Integer
value
)
{
setValue
(
2
,
value
);
}
/**
* Getter for <code>PUBLIC.BOOK_TO_BOOK_STORE.STOCK</code>.
*/
public
Integer
getStock
()
{
return
(
Integer
)
getValue
(
2
);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public
Record2
<
String
,
Integer
>
key
()
{
return
(
Record2
)
super
.
key
();
}
// -------------------------------------------------------------------------
// Record3 type implementation
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public
Row3
<
String
,
Integer
,
Integer
>
fieldsRow
()
{
return
(
Row3
)
super
.
fieldsRow
();
}
/**
* {@inheritDoc}
*/
@Override
public
Row3
<
String
,
Integer
,
Integer
>
valuesRow
()
{
return
(
Row3
)
super
.
valuesRow
();
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
String
>
field1
()
{
return
BookToBookStore
.
BOOK_TO_BOOK_STORE
.
NAME
;
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
Integer
>
field2
()
{
return
BookToBookStore
.
BOOK_TO_BOOK_STORE
.
BOOK_ID
;
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
Integer
>
field3
()
{
return
BookToBookStore
.
BOOK_TO_BOOK_STORE
.
STOCK
;
}
/**
* {@inheritDoc}
*/
@Override
public
String
value1
()
{
return
getName
();
}
/**
* {@inheritDoc}
*/
@Override
public
Integer
value2
()
{
return
getBookId
();
}
/**
* {@inheritDoc}
*/
@Override
public
Integer
value3
()
{
return
getStock
();
}
/**
* {@inheritDoc}
*/
@Override
public
BookToBookStoreRecord
value1
(
String
value
)
{
setName
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
BookToBookStoreRecord
value2
(
Integer
value
)
{
setBookId
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
BookToBookStoreRecord
value3
(
Integer
value
)
{
setStock
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
BookToBookStoreRecord
values
(
String
value1
,
Integer
value2
,
Integer
value3
)
{
value1
(
value1
);
value2
(
value2
);
value3
(
value3
);
return
this
;
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* Create a detached BookToBookStoreRecord
*/
public
BookToBookStoreRecord
()
{
super
(
BookToBookStore
.
BOOK_TO_BOOK_STORE
);
}
/**
* Create a detached, initialised BookToBookStoreRecord
*/
public
BookToBookStoreRecord
(
String
name
,
Integer
bookId
,
Integer
stock
)
{
super
(
BookToBookStore
.
BOOK_TO_BOOK_STORE
);
setValue
(
0
,
name
);
setValue
(
1
,
bookId
);
setValue
(
2
,
stock
);
}
}
spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/LanguageRecord.java
0 → 100644
View file @
ab1cc829
/**
* This class is generated by jOOQ
*/
package
sample
.
jooq
.
domain
.
tables
.
records
;
import
javax.annotation.Generated
;
import
org.jooq.Field
;
import
org.jooq.Record1
;
import
org.jooq.Record3
;
import
org.jooq.Row3
;
import
org.jooq.impl.UpdatableRecordImpl
;
import
sample.jooq.domain.tables.Language
;
/**
* This class is generated by jOOQ.
*/
@Generated
(
value
=
{
"http://www.jooq.org"
,
"jOOQ version:3.6.2"
},
comments
=
"This class is generated by jOOQ"
)
@SuppressWarnings
({
"all"
,
"unchecked"
,
"rawtypes"
})
public
class
LanguageRecord
extends
UpdatableRecordImpl
<
LanguageRecord
>
implements
Record3
<
Integer
,
String
,
String
>
{
private
static
final
long
serialVersionUID
=
-
1003202585
;
/**
* Setter for <code>PUBLIC.LANGUAGE.ID</code>.
*/
public
void
setId
(
Integer
value
)
{
setValue
(
0
,
value
);
}
/**
* Getter for <code>PUBLIC.LANGUAGE.ID</code>.
*/
public
Integer
getId
()
{
return
(
Integer
)
getValue
(
0
);
}
/**
* Setter for <code>PUBLIC.LANGUAGE.CD</code>.
*/
public
void
setCd
(
String
value
)
{
setValue
(
1
,
value
);
}
/**
* Getter for <code>PUBLIC.LANGUAGE.CD</code>.
*/
public
String
getCd
()
{
return
(
String
)
getValue
(
1
);
}
/**
* Setter for <code>PUBLIC.LANGUAGE.DESCRIPTION</code>.
*/
public
void
setDescription
(
String
value
)
{
setValue
(
2
,
value
);
}
/**
* Getter for <code>PUBLIC.LANGUAGE.DESCRIPTION</code>.
*/
public
String
getDescription
()
{
return
(
String
)
getValue
(
2
);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public
Record1
<
Integer
>
key
()
{
return
(
Record1
)
super
.
key
();
}
// -------------------------------------------------------------------------
// Record3 type implementation
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public
Row3
<
Integer
,
String
,
String
>
fieldsRow
()
{
return
(
Row3
)
super
.
fieldsRow
();
}
/**
* {@inheritDoc}
*/
@Override
public
Row3
<
Integer
,
String
,
String
>
valuesRow
()
{
return
(
Row3
)
super
.
valuesRow
();
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
Integer
>
field1
()
{
return
Language
.
LANGUAGE
.
ID
;
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
String
>
field2
()
{
return
Language
.
LANGUAGE
.
CD
;
}
/**
* {@inheritDoc}
*/
@Override
public
Field
<
String
>
field3
()
{
return
Language
.
LANGUAGE
.
DESCRIPTION
;
}
/**
* {@inheritDoc}
*/
@Override
public
Integer
value1
()
{
return
getId
();
}
/**
* {@inheritDoc}
*/
@Override
public
String
value2
()
{
return
getCd
();
}
/**
* {@inheritDoc}
*/
@Override
public
String
value3
()
{
return
getDescription
();
}
/**
* {@inheritDoc}
*/
@Override
public
LanguageRecord
value1
(
Integer
value
)
{
setId
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
LanguageRecord
value2
(
String
value
)
{
setCd
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
LanguageRecord
value3
(
String
value
)
{
setDescription
(
value
);
return
this
;
}
/**
* {@inheritDoc}
*/
@Override
public
LanguageRecord
values
(
Integer
value1
,
String
value2
,
String
value3
)
{
value1
(
value1
);
value2
(
value2
);
value3
(
value3
);
return
this
;
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* Create a detached LanguageRecord
*/
public
LanguageRecord
()
{
super
(
Language
.
LANGUAGE
);
}
/**
* Create a detached, initialised LanguageRecord
*/
public
LanguageRecord
(
Integer
id
,
String
cd
,
String
description
)
{
super
(
Language
.
LANGUAGE
);
setValue
(
0
,
id
);
setValue
(
1
,
cd
);
setValue
(
2
,
description
);
}
}
spring-boot-samples/spring-boot-sample-jooq/pom.xml
0 → 100644
View file @
ab1cc829
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<!-- Your own application should inherit from spring-boot-starter-parent -->
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-samples
</artifactId>
<version>
1.3.0.BUILD-SNAPSHOT
</version>
</parent>
<artifactId>
spring-boot-sample-jooq
</artifactId>
<name>
Spring Boot jOOQ Sample
</name>
<description>
Spring Boot jOOQ Sample
</description>
<url>
http://projects.spring.io/spring-boot/
</url>
<organization>
<name>
Pivotal Software, Inc.
</name>
<url>
http://www.spring.io
</url>
</organization>
<properties>
<main.basedir>
${basedir}/../..
</main.basedir>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-jooq
</artifactId>
</dependency>
<dependency>
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
build-helper-maven-plugin
</artifactId>
<executions>
<execution>
<phase>
generate-sources
</phase>
<goals>
<goal>
add-source
</goal>
</goals>
<configuration>
<sources>
<source>
gensrc/main/java
</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>
org.eclipse.m2e
</groupId>
<artifactId>
lifecycle-mapping
</artifactId>
<version>
1.0.0
</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.jooq
</groupId>
<artifactId>
jooq-codegen-maven
</artifactId>
<versionRange>
[3.6.2,)
</versionRange>
<goals>
<goal>
generate
</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>
generate
</id>
<build>
<plugins>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
sql-maven-plugin
</artifactId>
<version>
1.5
</version>
<executions>
<execution>
<phase>
generate-sources
</phase>
<goals>
<goal>
execute
</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
<version>
${h2.version}
</version>
</dependency>
</dependencies>
<configuration>
<driver>
org.h2.Driver
</driver>
<url>
jdbc:h2:~/springbootjooq
</url>
<srcFiles>
<srcFile>
${basedir}/src/main/resources/reset.sql
</srcFile>
<srcFile>
${basedir}/src/main/resources/schema.sql
</srcFile>
</srcFiles>
</configuration>
</plugin>
<plugin>
<groupId>
org.jooq
</groupId>
<artifactId>
jooq-codegen-maven
</artifactId>
<executions>
<execution>
<goals>
<goal>
generate
</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
<version>
${h2.version}
</version>
</dependency>
</dependencies>
<configuration>
<jdbc>
<driver>
org.h2.Driver
</driver>
<url>
jdbc:h2:~/springbootjooq
</url>
</jdbc>
<generator>
<name>
org.jooq.util.DefaultGenerator
</name>
<database>
<name>
org.jooq.util.h2.H2Database
</name>
<includes>
.*
</includes>
<excludes></excludes>
<inputSchema>
PUBLIC
</inputSchema>
</database>
<target>
<packageName>
sample.jooq.domain
</packageName>
<directory>
${basedir}/gensrc/main/java
</directory>
</target>
</generator>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
spring-boot-samples/spring-boot-sample-jooq/src/main/java/sample/jooq/JooqExamples.java
0 → 100644
View file @
ab1cc829
/*
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
sample
.
jooq
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.util.List
;
import
org.jooq.DSLContext
;
import
org.jooq.Query
;
import
org.jooq.Record
;
import
org.jooq.Result
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.RowMapper
;
import
org.springframework.stereotype.Component
;
import
static
sample
.
jooq
.
domain
.
tables
.
Author
.
AUTHOR
;
import
static
sample
.
jooq
.
domain
.
tables
.
Book
.
BOOK
;
@Component
public
class
JooqExamples
implements
CommandLineRunner
{
private
final
DSLContext
dsl
;
private
final
JdbcTemplate
jdbc
;
@Autowired
public
JooqExamples
(
DSLContext
dsl
,
JdbcTemplate
jdbc
)
{
this
.
dsl
=
dsl
;
this
.
jdbc
=
jdbc
;
}
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
jooqFetch
();
jooqSql
();
}
private
void
jooqFetch
()
{
Result
<
Record
>
results
=
this
.
dsl
.
select
().
from
(
AUTHOR
).
fetch
();
for
(
Record
result
:
results
)
{
Integer
id
=
result
.
getValue
(
AUTHOR
.
ID
);
String
firstName
=
result
.
getValue
(
AUTHOR
.
FIRST_NAME
);
String
lastName
=
result
.
getValue
(
AUTHOR
.
LAST_NAME
);
System
.
out
.
println
(
"jOOQ Fetch "
+
id
+
" "
+
firstName
+
" "
+
lastName
);
}
}
private
void
jooqSql
()
{
Query
query
=
this
.
dsl
.
select
(
BOOK
.
TITLE
,
AUTHOR
.
FIRST_NAME
,
AUTHOR
.
LAST_NAME
)
.
from
(
BOOK
).
join
(
AUTHOR
).
on
(
BOOK
.
AUTHOR_ID
.
equal
(
AUTHOR
.
ID
))
.
where
(
BOOK
.
PUBLISHED_IN
.
equal
(
2015
));
Object
[]
bind
=
query
.
getBindValues
().
toArray
(
new
Object
[]
{});
List
<
String
>
list
=
this
.
jdbc
.
query
(
query
.
getSQL
(),
bind
,
new
RowMapper
<
String
>()
{
@Override
public
String
mapRow
(
ResultSet
rs
,
int
rowNum
)
throws
SQLException
{
return
rs
.
getString
(
1
)
+
" : "
+
rs
.
getString
(
2
)
+
" "
+
rs
.
getString
(
3
);
}
});
System
.
out
.
println
(
"jOOQ SQL "
+
list
);
}
}
spring-boot-samples/spring-boot-sample-jooq/src/main/java/sample/jooq/SampleJooqApplication.java
0 → 100644
View file @
ab1cc829
/*
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
sample
.
jooq
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
SampleJooqApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
SampleJooqApplication
.
class
,
args
);
}
}
spring-boot-samples/spring-boot-sample-jooq/src/main/resources/data.sql
0 → 100644
View file @
ab1cc829
INSERT
INTO
language
VALUES
(
1
,
'EN'
,
'English'
);
INSERT
INTO
author
VALUES
(
1
,
'Greg'
,
'Turnquest'
,
'1804-09-17'
,
1804
,
1
);
INSERT
INTO
author
VALUES
(
2
,
'Craig'
,
'Walls'
,
'1804-09-18'
,
1804
,
1
);
INSERT
INTO
book
VALUES
(
1
,
1
,
'Learning Spring Boot'
,
2015
,
1
);
INSERT
INTO
book
VALUES
(
2
,
2
,
'Spring Boot in Action'
,
2015
,
1
);
INSERT
INTO
book_store
VALUES
(
'Barnes & Noble'
);
INSERT
INTO
book_to_book_store
VALUES
(
'Barnes & Noble'
,
1
,
10
);
INSERT
INTO
book_to_book_store
VALUES
(
'Barnes & Noble'
,
2
,
3
);
spring-boot-samples/spring-boot-sample-jooq/src/main/resources/reset.sql
0 → 100644
View file @
ab1cc829
DROP
ALL
OBJECTS
;
\ No newline at end of file
spring-boot-samples/spring-boot-sample-jooq/src/main/resources/schema.sql
0 → 100644
View file @
ab1cc829
CREATE
TABLE
language
(
id
NUMBER
(
7
)
NOT
NULL
PRIMARY
KEY
,
cd
CHAR
(
2
)
NOT
NULL
,
description
VARCHAR2
(
50
)
);
CREATE
TABLE
author
(
id
NUMBER
(
7
)
NOT
NULL
PRIMARY
KEY
,
first_name
VARCHAR2
(
50
),
last_name
VARCHAR2
(
50
)
NOT
NULL
,
date_of_birth
DATE
,
year_of_birth
NUMBER
(
7
),
distinguished
NUMBER
(
1
)
);
CREATE
TABLE
book
(
id
NUMBER
(
7
)
NOT
NULL
PRIMARY
KEY
,
author_id
NUMBER
(
7
)
NOT
NULL
,
title
VARCHAR2
(
400
)
NOT
NULL
,
published_in
NUMBER
(
7
)
NOT
NULL
,
language_id
NUMBER
(
7
)
NOT
NULL
,
CONSTRAINT
fk_book_author
FOREIGN
KEY
(
author_id
)
REFERENCES
author
(
id
),
CONSTRAINT
fk_book_language
FOREIGN
KEY
(
language_id
)
REFERENCES
language
(
id
)
);
CREATE
TABLE
book_store
(
name
VARCHAR2
(
400
)
NOT
NULL
UNIQUE
);
CREATE
TABLE
book_to_book_store
(
name
VARCHAR2
(
400
)
NOT
NULL
,
book_id
INTEGER
NOT
NULL
,
stock
INTEGER
,
PRIMARY
KEY
(
name
,
book_id
),
CONSTRAINT
fk_b2bs_book_store
FOREIGN
KEY
(
name
)
REFERENCES
book_store
(
name
)
ON
DELETE
CASCADE
,
CONSTRAINT
fk_b2bs_book
FOREIGN
KEY
(
book_id
)
REFERENCES
book
(
id
)
ON
DELETE
CASCADE
);
spring-boot-samples/spring-boot-sample-jooq/src/test/java/sample/jooq/SampleJooqApplicationTests.java
0 → 100644
View file @
ab1cc829
/*
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
sample
.
jooq
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.springframework.boot.test.OutputCapture
;
import
static
org
.
hamcrest
.
Matchers
.
containsString
;
import
static
org
.
junit
.
Assert
.
assertThat
;
/**
* Integration tests for {@link SampleJooqApplication}.
*/
public
class
SampleJooqApplicationTests
{
private
static
final
String
[]
NO_ARGS
=
{};
@Rule
public
OutputCapture
out
=
new
OutputCapture
();
@Test
public
void
outputResults
()
throws
Exception
{
SampleJooqApplication
.
main
(
NO_ARGS
);
assertThat
(
this
.
out
.
toString
(),
containsString
(
"jOOQ Fetch 1 Greg Turnquest"
));
assertThat
(
this
.
out
.
toString
(),
containsString
(
"jOOQ Fetch 2 Craig Walls"
));
assertThat
(
this
.
out
.
toString
(),
containsString
(
"jOOQ SQL "
+
"[Learning Spring Boot : Greg Turnquest, "
+
"Spring Boot in Action : Craig Walls]"
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment