diff --git a/jOOQ-examples/jOOQ-spring-boot-example/README.md b/jOOQ-examples/jOOQ-spring-boot-example/README.md
new file mode 100644
index 0000000000..813f616769
--- /dev/null
+++ b/jOOQ-examples/jOOQ-spring-boot-example/README.md
@@ -0,0 +1,19 @@
+Thanks for downloading jOOQ.
+Please visit http://www.jooq.org for more information.
+
+This example was inspired by Petri Kainulainen's excellent blog post:
+http://www.petrikainulainen.net/programming/jooq/using-jooq-with-spring-configuration/
+
+To install and run this example, please check out the complete jOOQ repository first, and use Maven to install the latest SNAPSHOT version of jOOQ:
+
+```
+$ pwd
+/path/to/checkout/dir
+$ ls
+jOOQ jOOQ-meta jOOQ-codegen ...
+$ mvn clean install
+...
+$ cd jOOQ-examples/jOOQ-spring-boot-example
+...
+$ mvn clean install
+```
diff --git a/jOOQ-examples/jOOQ-spring-boot-example/pom.xml b/jOOQ-examples/jOOQ-spring-boot-example/pom.xml
new file mode 100644
index 0000000000..d8419b8ff6
--- /dev/null
+++ b/jOOQ-examples/jOOQ-spring-boot-example/pom.xml
@@ -0,0 +1,171 @@
+
+
+ * The implementation of this method has a bug, which causes this method to fail and roll back the transaction.
+ */
+ @Transactional
+ void create(int id, int authorId, String title);
+
+}
diff --git a/jOOQ-examples/jOOQ-spring-boot-example/src/main/java/org/jooq/example/spring/DefaultBookService.java b/jOOQ-examples/jOOQ-spring-boot-example/src/main/java/org/jooq/example/spring/DefaultBookService.java
new file mode 100644
index 0000000000..d624e924a5
--- /dev/null
+++ b/jOOQ-examples/jOOQ-spring-boot-example/src/main/java/org/jooq/example/spring/DefaultBookService.java
@@ -0,0 +1,27 @@
+package org.jooq.example.spring;
+
+import static org.jooq.example.db.h2.Tables.BOOK;
+
+import org.jooq.DSLContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author Lukas Eder
+ */
+@Service
+public class DefaultBookService implements BookService {
+
+ @Autowired DSLContext dsl;
+
+ @Override
+ @Transactional
+ public void create(int id, int authorId, String title) {
+
+ // This method has a "bug". It creates the same book twice. The second insert
+ // should lead to a constraint violation, which should roll back the whole transaction
+ for (int i = 0; i < 2; i++)
+ dsl.insertInto(BOOK).set(BOOK.ID, id).set(BOOK.AUTHOR_ID, authorId).set(BOOK.TITLE, title).execute();
+ }
+}
diff --git a/jOOQ-examples/jOOQ-spring-boot-example/src/main/java/org/jooq/example/spring/ExceptionTranslator.java b/jOOQ-examples/jOOQ-spring-boot-example/src/main/java/org/jooq/example/spring/ExceptionTranslator.java
new file mode 100644
index 0000000000..094bfe7d07
--- /dev/null
+++ b/jOOQ-examples/jOOQ-spring-boot-example/src/main/java/org/jooq/example/spring/ExceptionTranslator.java
@@ -0,0 +1,36 @@
+package org.jooq.example.spring;
+
+import org.jooq.ExecuteContext;
+import org.jooq.SQLDialect;
+import org.jooq.impl.DefaultExecuteListener;
+import org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator;
+import org.springframework.jdbc.support.SQLExceptionTranslator;
+import org.springframework.jdbc.support.SQLStateSQLExceptionTranslator;
+
+/**
+ * This class transforms SQLException into a Spring specific DataAccessException. The idea behind this is borrowed from
+ * Adam Zell's Gist
+ *
+ * @author Petri Kainulainen
+ * @author Adam Zell
+ * @author Lukas Eder
+ * @see http://www.petrikainulainen.net/programming/jooq/using-jooq-with-spring-configuration/
+ * @see https://gist.github.com/azell/5655888
+ */
+public class ExceptionTranslator extends DefaultExecuteListener {
+
+ /**
+ * Generated UID
+ */
+ private static final long serialVersionUID = -2450323227461061152L;
+
+ @Override
+ public void exception(ExecuteContext ctx) {
+ SQLDialect dialect = ctx.configuration().dialect();
+ SQLExceptionTranslator translator = (dialect != null) ? new SQLErrorCodeSQLExceptionTranslator(dialect.name())
+ : new SQLStateSQLExceptionTranslator();
+
+ ctx.exception(translator.translate("jOOQ", ctx.sql(), ctx.sqlException()));
+ }
+}
diff --git a/jOOQ-examples/jOOQ-spring-boot-example/src/main/java/org/jooq/example/spring/SpringTransaction.java b/jOOQ-examples/jOOQ-spring-boot-example/src/main/java/org/jooq/example/spring/SpringTransaction.java
new file mode 100644
index 0000000000..1ecdd13dd3
--- /dev/null
+++ b/jOOQ-examples/jOOQ-spring-boot-example/src/main/java/org/jooq/example/spring/SpringTransaction.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2009-2013, Data Geekery GmbH (http://www.datageekery.com)
+ * All rights reserved.
+ *
+ * This work is dual-licensed
+ * - under the Apache Software License 2.0 (the "ASL")
+ * - under the jOOQ License and Maintenance Agreement (the "jOOQ License")
+ * =============================================================================
+ * You may choose which license applies to you:
+ *
+ * - If you're using this work with Open Source databases, you may choose
+ * either ASL or jOOQ License.
+ * - If you're using this work with at least one commercial database, you must
+ * choose jOOQ License
+ *
+ * For more information, please visit http://www.jooq.org/licenses
+ *
+ * Apache Software License 2.0:
+ * -----------------------------------------------------------------------------
+ * 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.
+ *
+ * jOOQ License and Maintenance Agreement:
+ * -----------------------------------------------------------------------------
+ * Data Geekery grants the Customer the non-exclusive, timely limited and
+ * non-transferable license to install and use the Software under the terms of
+ * the jOOQ License and Maintenance Agreement.
+ *
+ * This library is distributed with a LIMITED WARRANTY. See the jOOQ License
+ * and Maintenance Agreement for more details: http://www.jooq.org/licensing
+ */
+package org.jooq.example.spring;
+
+import org.jooq.Transaction;
+import org.springframework.transaction.TransactionStatus;
+
+class SpringTransaction implements Transaction {
+ final TransactionStatus tx;
+
+ SpringTransaction(TransactionStatus tx) {
+ this.tx = tx;
+ }
+}
diff --git a/jOOQ-examples/jOOQ-spring-boot-example/src/main/java/org/jooq/example/spring/SpringTransactionProvider.java b/jOOQ-examples/jOOQ-spring-boot-example/src/main/java/org/jooq/example/spring/SpringTransactionProvider.java
new file mode 100644
index 0000000000..44d8b448f0
--- /dev/null
+++ b/jOOQ-examples/jOOQ-spring-boot-example/src/main/java/org/jooq/example/spring/SpringTransactionProvider.java
@@ -0,0 +1,88 @@
+/**
+ * Copyright (c) 2009-2013, Data Geekery GmbH (http://www.datageekery.com)
+ * All rights reserved.
+ *
+ * This work is dual-licensed
+ * - under the Apache Software License 2.0 (the "ASL")
+ * - under the jOOQ License and Maintenance Agreement (the "jOOQ License")
+ * =============================================================================
+ * You may choose which license applies to you:
+ *
+ * - If you're using this work with Open Source databases, you may choose
+ * either ASL or jOOQ License.
+ * - If you're using this work with at least one commercial database, you must
+ * choose jOOQ License
+ *
+ * For more information, please visit http://www.jooq.org/licenses
+ *
+ * Apache Software License 2.0:
+ * -----------------------------------------------------------------------------
+ * 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.
+ *
+ * jOOQ License and Maintenance Agreement:
+ * -----------------------------------------------------------------------------
+ * Data Geekery grants the Customer the non-exclusive, timely limited and
+ * non-transferable license to install and use the Software under the terms of
+ * the jOOQ License and Maintenance Agreement.
+ *
+ * This library is distributed with a LIMITED WARRANTY. See the jOOQ License
+ * and Maintenance Agreement for more details: http://www.jooq.org/licensing
+ */
+package org.jooq.example.spring;
+
+import static org.springframework.transaction.TransactionDefinition.PROPAGATION_NESTED;
+
+import org.jooq.TransactionContext;
+import org.jooq.TransactionProvider;
+import org.jooq.tools.JooqLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.DefaultTransactionDefinition;
+
+/**
+ * An example TransactionProvider implementing the {@link TransactionProvider} contract for use with
+ * Spring.
+ *
+ * @author Lukas Eder
+ */
+public class SpringTransactionProvider implements TransactionProvider {
+
+ private static final JooqLogger log = JooqLogger.getLogger(SpringTransactionProvider.class);
+
+ @Autowired DataSourceTransactionManager txMgr;
+
+ @Override
+ public void begin(TransactionContext ctx) {
+ log.info("Begin transaction");
+
+ // This TransactionProvider behaves like jOOQ's DefaultTransactionProvider,
+ // which supports nested transactions using Savepoints
+ TransactionStatus tx = txMgr.getTransaction(new DefaultTransactionDefinition(PROPAGATION_NESTED));
+ ctx.transaction(new SpringTransaction(tx));
+ }
+
+ @Override
+ public void commit(TransactionContext ctx) {
+ log.info("commit transaction");
+
+ txMgr.commit(((SpringTransaction) ctx.transaction()).tx);
+ }
+
+ @Override
+ public void rollback(TransactionContext ctx) {
+ log.info("rollback transaction");
+
+ txMgr.rollback(((SpringTransaction) ctx.transaction()).tx);
+ }
+}
diff --git a/jOOQ-examples/jOOQ-spring-boot-example/src/main/resources/application.properties b/jOOQ-examples/jOOQ-spring-boot-example/src/main/resources/application.properties
new file mode 100644
index 0000000000..e99917644e
--- /dev/null
+++ b/jOOQ-examples/jOOQ-spring-boot-example/src/main/resources/application.properties
@@ -0,0 +1,12 @@
+#Database Configuration
+spring.datasource.driverClassName=org.h2.Driver
+spring.datasource.url=jdbc:h2:~/jooq-spring-boot-example
+spring.datasource.username=sa
+spring.datasource.password=
+
+#jOOQ Configuration
+jooq.sql.dialect=H2
+
+
+spring.datasource.initialize=false
+spring.datasource.continueOnError=true
\ No newline at end of file
diff --git a/jOOQ-examples/jOOQ-spring-boot-example/src/main/resources/data-h2.sql b/jOOQ-examples/jOOQ-spring-boot-example/src/main/resources/data-h2.sql
new file mode 100644
index 0000000000..0dc4b58a4a
--- /dev/null
+++ b/jOOQ-examples/jOOQ-spring-boot-example/src/main/resources/data-h2.sql
@@ -0,0 +1,20 @@
+INSERT INTO author VALUES (next value for s_author_id, 'George', 'Orwell', '1903-06-25', 1903, null);
+INSERT INTO author VALUES (next value for s_author_id, 'Paulo', 'Coelho', '1947-08-24', 1947, null);
+
+INSERT INTO book VALUES (1, 1, null, null, '1984', 1948, 1, 'To know and not to know, to be conscious of complete truthfulness while telling carefully constructed lies, to hold simultaneously two opinions which cancelled out, knowing them to be contradictory and believing in both of them, to use logic against logic, to repudiate morality while laying claim to it, to believe that democracy was impossible and that the Party was the guardian of democracy, to forget, whatever it was necessary to forget, then to draw it back into memory again at the moment when it was needed, and then promptly to forget it again, and above all, to apply the same process to the process itself -- that was the ultimate subtlety; consciously to induce unconsciousness, and then, once again, to become unconscious of the act of hypnosis you had just performed. Even to understand the word ''doublethink'' involved the use of doublethink..', null, 1, '2010-01-01 00:00:00');
+INSERT INTO book VALUES (2, 1, null, null, 'Animal Farm', 1945, 1, null, null, null, '2010-01-01 00:00:00');
+INSERT INTO book VALUES (3, 2, null, null, 'O Alquimista', 1988, 4, null, null, 1, null);
+INSERT INTO book VALUES (4, 2, null, null, 'Brida', 1990, 2, null, null, null, null);
+
+INSERT INTO book_store (name) VALUES
+ ('Orell Füssli'),
+ ('Ex Libris'),
+ ('Buchhandlung im Volkshaus');
+
+INSERT INTO book_to_book_store VALUES
+ ('Orell Füssli', 1, 10),
+ ('Orell Füssli', 2, 10),
+ ('Orell Füssli', 3, 10),
+ ('Ex Libris', 1, 1),
+ ('Ex Libris', 3, 2),
+ ('Buchhandlung im Volkshaus', 3, 1);
diff --git a/jOOQ-examples/jOOQ-spring-boot-example/src/main/resources/schema-h2.sql b/jOOQ-examples/jOOQ-spring-boot-example/src/main/resources/schema-h2.sql
new file mode 100644
index 0000000000..cb329b9077
--- /dev/null
+++ b/jOOQ-examples/jOOQ-spring-boot-example/src/main/resources/schema-h2.sql
@@ -0,0 +1,57 @@
+DROP TABLE IF EXISTS book_to_book_store;
+DROP TABLE IF EXISTS book_store;
+DROP TABLE IF EXISTS book;
+DROP TABLE IF EXISTS author;
+
+DROP SEQUENCE IF EXISTS s_author_id;
+CREATE SEQUENCE s_author_id START WITH 1;
+
+CREATE TABLE author (
+ id INT NOT NULL,
+ first_name VARCHAR(50),
+ last_name VARCHAR(50) NOT NULL,
+ date_of_birth DATE,
+ year_of_birth INT,
+ address VARCHAR(50),
+
+ CONSTRAINT pk_t_author PRIMARY KEY (ID)
+);
+
+CREATE TABLE book (
+ id INT NOT NULL,
+ author_id INT NOT NULL,
+ co_author_id INT,
+ details_id INT,
+ title VARCHAR(400) NOT NULL,
+ published_in INT,
+ language_id INT,
+ content_text CLOB,
+ content_pdf BLOB,
+
+ rec_version INT,
+ rec_timestamp TIMESTAMP,
+
+ CONSTRAINT pk_t_book PRIMARY KEY (id),
+ CONSTRAINT fk_t_book_author_id FOREIGN KEY (author_id) REFERENCES author(id),
+ CONSTRAINT fk_t_book_co_author_id FOREIGN KEY (co_author_id) REFERENCES author(id)
+);
+
+CREATE TABLE book_store (
+ name VARCHAR(400) NOT NULL,
+
+ CONSTRAINT uk_t_book_store_name PRIMARY KEY(name)
+);
+
+CREATE TABLE book_to_book_store (
+ book_store_name VARCHAR(400) NOT NULL,
+ book_id INTEGER NOT NULL,
+ stock INTEGER,
+
+ CONSTRAINT pk_b2bs PRIMARY KEY(book_store_name, book_id),
+ CONSTRAINT fk_b2bs_bs_name FOREIGN KEY (book_store_name)
+ REFERENCES book_store (name)
+ ON DELETE CASCADE,
+ CONSTRAINT fk_b2bs_b_id FOREIGN KEY (book_id)
+ REFERENCES book (id)
+ ON DELETE CASCADE
+);
\ No newline at end of file
diff --git a/jOOQ-examples/jOOQ-spring-boot-example/src/test/java/org/jooq/example/spring/QueryTest.java b/jOOQ-examples/jOOQ-spring-boot-example/src/test/java/org/jooq/example/spring/QueryTest.java
new file mode 100644
index 0000000000..32893b0884
--- /dev/null
+++ b/jOOQ-examples/jOOQ-spring-boot-example/src/test/java/org/jooq/example/spring/QueryTest.java
@@ -0,0 +1,66 @@
+package org.jooq.example.spring;
+
+import static java.util.Arrays.asList;
+import static org.jooq.example.db.h2.Tables.AUTHOR;
+import static org.jooq.example.db.h2.Tables.BOOK;
+import static org.jooq.example.db.h2.Tables.BOOK_STORE;
+import static org.jooq.example.db.h2.Tables.BOOK_TO_BOOK_STORE;
+import static org.jooq.impl.DSL.countDistinct;
+import static org.junit.Assert.assertEquals;
+
+import org.jooq.DSLContext;
+import org.jooq.Record3;
+import org.jooq.Result;
+import org.jooq.example.db.h2.tables.Author;
+import org.jooq.example.db.h2.tables.Book;
+import org.jooq.example.db.h2.tables.BookStore;
+import org.jooq.example.db.h2.tables.BookToBookStore;
+import org.jooq.example.db.h2.tables.records.BookRecord;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * @author Lukas Eder
+ * @author Thomas Darimont
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringApplicationConfiguration(classes = Application.class)
+public class QueryTest {
+
+ @Autowired DSLContext create;
+
+ @Test
+ public void testJoin() throws Exception {
+ // All of these tables were generated by jOOQ's Maven plugin
+ Book b = BOOK.as("b");
+ Author a = AUTHOR.as("a");
+ BookStore s = BOOK_STORE.as("s");
+ BookToBookStore t = BOOK_TO_BOOK_STORE.as("t");
+
+ Result