diff --git a/jOOQ-examples/jOOQ-javaee-example/.gitignore b/jOOQ-examples/jOOQ-javaee-example/.gitignore deleted file mode 100644 index 9df5d49712..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target -/*.iml \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/LICENSE.txt b/jOOQ-examples/jOOQ-javaee-example/LICENSE.txt deleted file mode 100644 index d090694f44..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/LICENSE.txt +++ /dev/null @@ -1,19 +0,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. - -Other licenses: ------------------------------------------------------------------------------ -Commercial licenses for this work are available. These replace the above -ASL 2.0 and offer limited warranties, support, maintenance, and commercial -database integrations. - -For more information, please visit: http://www.jooq.org/licenses \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/README.md b/jOOQ-examples/jOOQ-javaee-example/README.md deleted file mode 100644 index 534679b746..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/README.md +++ /dev/null @@ -1,26 +0,0 @@ -Thanks for downloading jOOQ. -Please visit http://www.jooq.org for more information. - -To install and run this example, simply check it out and run the following Maven command - -``` -$ pwd -/path/to/checkout/dir -$ cd jOOQ-examples/jOOQ-javaee-example -... -$ mvn clean install -``` - -After the above, you should find a `jooq-javaee-example.war` file in - -``` -$ pwd -/path/to/checkout/dir -$ cd jOOQ-examples/jOOQ-javaee-example/target -... -``` - -You can deploy this war file in your WildFly AS or any other application server. The example will use an embedded H2 database, which should be pre-filled with the library example H2 database. It uses a non-managed `DataSource`, which is configured and consumed directly by the application itself. - -For more information about how to setup a WildFly project using EJB, please visit the WildFly Quickstart projects, e.g.: -https://github.com/wildfly/quickstart/tree/master/ejb-in-war \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/pom.xml b/jOOQ-examples/jOOQ-javaee-example/pom.xml deleted file mode 100644 index cc61d62b5f..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/pom.xml +++ /dev/null @@ -1,235 +0,0 @@ - - - 4.0.0 - - - org.jooq - jooq-examples - 3.16.0-SNAPSHOT - - - jooq-javaee-example - war - jOOQ JavaEE Example - - - - Apache License, Version 2.0 - http://www.jooq.org/inc/LICENSE.txt - repo - - - - - UTF-8 - 1.4.199 - 1.8 - - - 1.0.2.Final - 8.0.0.Final - - 10990 - admin - admin - - - 2.10 - 2.1.1 - - - - - - - - org.wildfly.bom - jboss-javaee-7.0-with-tools - ${version.jboss.bom} - pom - import - - - - - - - - - org.jooq - jooq - - - com.h2database - h2 - - - - - javax.enterprise - cdi-api - provided - - - org.jboss.spec.javax.annotation - jboss-annotations-api_1.2_spec - provided - - - org.jboss.spec.javax.faces - jboss-jsf-api_2.2_spec - provided - - - org.jboss.spec.javax.ejb - jboss-ejb-api_3.2_spec - provided - - - - - org.apache.logging.log4j - log4j-slf4j18-impl - - - - - junit - junit - jar - test - - - - - ${project.artifactId} - - - maven-war-plugin - ${version.war.plugin} - - false - - - - maven-compiler-plugin - - - 11 - - - - 11 - 11 - - - - - - org.codehaus.mojo - properties-maven-plugin - 1.0.0 - - - initialize - - read-project-properties - - - - src/main/resources/config.properties - - - - - - - - - org.codehaus.mojo - sql-maven-plugin - - - ${maven.test.skip} - always - - - - - create-database-h2 - generate-sources - - execute - - - ${db.driver} - ${db.url} - ${db.username} - ${db.password} - - true - - src/main/resources/db-h2.sql - - - - - - - - com.h2database - h2 - ${org.h2.version} - - - - - - - org.jooq - jooq-codegen-maven - - - - generate-h2 - generate-sources - - generate - - - - ${db.driver} - ${db.url} - ${db.username} - ${db.password} - - - - .* - - PUBLIC - - - org.jooq.example.db.h2 - target/generated-sources/jooq-h2 - - - - - - - - - \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/src/main/java/org/jooq/example/javaee/controller/Library.java b/jOOQ-examples/jOOQ-javaee-example/src/main/java/org/jooq/example/javaee/controller/Library.java deleted file mode 100644 index aecfed7fbc..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/src/main/java/org/jooq/example/javaee/controller/Library.java +++ /dev/null @@ -1,257 +0,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. - * - * Other licenses: - * ----------------------------------------------------------------------------- - * Commercial licenses for this work are available. These replace the above - * ASL 2.0 and offer limited warranties, support, maintenance, and commercial - * database integrations. - * - * For more information, please visit: http://www.jooq.org/licenses - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -package org.jooq.example.javaee.controller; - -import static java.util.Comparator.comparing; -import static java.util.stream.Collectors.toMap; -import static org.jooq.SQLDialect.H2; -import static org.jooq.SortOrder.ASC; -import static org.jooq.example.db.h2.tables.Author.AUTHOR; -import static org.jooq.example.db.h2.tables.Book.BOOK; - -import java.io.Serializable; -import java.util.Map; -import java.util.stream.Stream; - -import javax.ejb.EJB; -import javax.enterprise.context.SessionScoped; -import javax.inject.Named; - -import org.jooq.Field; -import org.jooq.Record; -import org.jooq.Result; -import org.jooq.SortField; -import org.jooq.Table; -import org.jooq.TableField; -import org.jooq.UpdatableRecord; -import org.jooq.example.db.h2.tables.Author; -import org.jooq.example.db.h2.tables.records.AuthorRecord; -import org.jooq.example.db.h2.tables.records.BookRecord; -import org.jooq.example.javaee.ejb.LibraryEJB; -import org.jooq.impl.DSL; - -/** - * A bean to be used from JSF pages. - *

- * The bean is session scoped such that we can have session-based caches of - * database content such as authors or books in this bean. In this simple - * example, we haven't gone into concurrency situations where multiple sessions - * update the library database at the same time, in case of which we might need - * to turn on optimistic locking in jOOQ. - * - * @author Lukas Eder - */ -@Named("library") -@SessionScoped -public class Library implements Serializable { - - private static final long serialVersionUID = 1L; - - @EJB - private LibraryEJB ejb; - - // Various caches from the DB - // ------------------------------------------------------------------------- - - /** - * An empty {@link AuthorRecord} that can be used to insert new authors. - */ - private AuthorRecord newAuthor; - - /** - * An empty {@link BookRecord} that can be used to insert new books. - */ - private BookRecord newBook; - - /** - * The reference to the {@link Record} that is currently being edited. - */ - private Record edit; - - /** - * The sort field for each {@link Table}. - */ - private Map, SortField> sort = Stream.of(AUTHOR.ID, BOOK.ID).collect( - toMap(f -> f.getTable(), f -> f.asc())); - - /** - * A cache of all {@link AuthorRecord}s currently in the database. - */ - private Result authors; - - /** - * A copy of {@link #authors} that is always sorted alphanumerically. - */ - private Result authorsAlphanumeric; - - /** - * A cache of all {@link BookRecord}s currently in the database. - */ - private Result books; - - // Data access methods - // ------------------------------------------------------------------------- - - public Result getAuthors() { - if (authors == null) - authors = ejb.fetchAuthors(sort.get(AUTHOR)); - - return authors; - } - - public Result getAuthorsAlphanumeric() { - if (authorsAlphanumeric == null) { - authorsAlphanumeric = DSL.using(H2).newResult(AUTHOR); - authorsAlphanumeric.addAll(getAuthors()); - authorsAlphanumeric.sortAsc(comparing(a -> a.getFirstName() + " " + a.getLastName())); - } - - return authorsAlphanumeric; - } - - public Map getAuthorById() { - return getAuthors().intoMap(AUTHOR.ID); - } - - public Result getBooks() { - if (books == null) - books = ejb.fetchBooks(sort.get(BOOK)); - - return books; - } - - public AuthorRecord getNewAuthor() { - if (newAuthor == null) - newAuthor = DSL.using(H2).newRecord(AUTHOR); - - return newAuthor; - } - - public BookRecord getNewBook() { - if (newBook == null) - newBook = DSL.using(H2).newRecord(BOOK); - - return newBook; - } - - // UI state methods - // ------------------------------------------------------------------------- - - /** - * The record being edited. - */ - public Record getEdit() { - return edit; - } - - /** - * A map containing column name -> column pairs of the - * {@link Author} table. - */ - public Map> getAuthorColumns() { - return getColumns(AUTHOR); - } - - /** - * A map containing column name -> column pairs of the - * {@link Author} table. - */ - public Map> getBookColumns() { - return getColumns(BOOK); - } - - /** - * Get a map containing table name -> sort field pairs. - */ - public Map> getSort() { - return sort.entrySet().stream().collect(toMap(e -> e.getKey().getName(), e -> e.getValue())); - } - - private Map> getColumns(Table t) { - return Stream.of(t.fields()).collect(toMap(f -> f.getName(), f -> f)); - } - - private void reset() { - authors = null; - authorsAlphanumeric = null; - books = null; - edit = null; - } - - // Actions - // ------------------------------------------------------------------------- - - /** - * Sort a table by a new field. - */ - public void sort(TableField field) { - SortField previous = sort.get(field.getTable()); - sort.put(field.getTable(), - ! previous.getName().equals(field.getName()) - ? field.asc() - : previous.getOrder() == ASC - ? field.desc() - : field.asc() - ); - - reset(); - } - - /** - * Mark a record as the one being currently edited. - */ - public void edit(UpdatableRecord record) { - edit = record; - } - - /** - * Save a record back to the database. - */ - public void save(UpdatableRecord author) { - ejb.store(author); - reset(); - } - - /** - * Delete a record from the database. - */ - public void delete(UpdatableRecord author) { - ejb.delete(author); - reset(); - } -} diff --git a/jOOQ-examples/jOOQ-javaee-example/src/main/java/org/jooq/example/javaee/ejb/LibraryEJB.java b/jOOQ-examples/jOOQ-javaee-example/src/main/java/org/jooq/example/javaee/ejb/LibraryEJB.java deleted file mode 100644 index 543bbc0b0e..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/src/main/java/org/jooq/example/javaee/ejb/LibraryEJB.java +++ /dev/null @@ -1,91 +0,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. - * - * Other licenses: - * ----------------------------------------------------------------------------- - * Commercial licenses for this work are available. These replace the above - * ASL 2.0 and offer limited warranties, support, maintenance, and commercial - * database integrations. - * - * For more information, please visit: http://www.jooq.org/licenses - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -package org.jooq.example.javaee.ejb; - -import static org.jooq.SQLDialect.H2; -import static org.jooq.example.db.h2.Tables.AUTHOR; -import static org.jooq.example.db.h2.Tables.BOOK; - -import javax.annotation.Resource; -import javax.ejb.Stateless; -import javax.sql.DataSource; - -import org.jooq.Result; -import org.jooq.SortField; -import org.jooq.UpdatableRecord; -import org.jooq.example.db.h2.tables.records.AuthorRecord; -import org.jooq.example.db.h2.tables.records.BookRecord; -import org.jooq.impl.DSL; - -/** - * A session bean that uses the configured {@link DataSource} to interact with - * the embedded H2 database. - * - * @author Lukas Eder - */ -@Stateless -public class LibraryEJB { - - @Resource(lookup="java:jboss/datasources/jooq-javaee-example") - private DataSource ds; - - public Result fetchAuthors(SortField sort) { - return DSL.using(ds, H2) - .selectFrom(AUTHOR) - .orderBy(sort) - .fetch(); - } - - public Result fetchBooks(SortField sort) { - return DSL.using(ds, H2) - .selectFrom(BOOK) - .orderBy(sort) - .fetch(); - } - - public void store(UpdatableRecord record) { - DSL.using(ds, H2).attach(record); - record.store(); - } - - public void delete(UpdatableRecord record) { - DSL.using(ds, H2).attach(record); - record.delete(); - } - -} \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/src/main/resources/META-INF/LICENSE.txt b/jOOQ-examples/jOOQ-javaee-example/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index d090694f44..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,19 +0,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. - -Other licenses: ------------------------------------------------------------------------------ -Commercial licenses for this work are available. These replace the above -ASL 2.0 and offer limited warranties, support, maintenance, and commercial -database integrations. - -For more information, please visit: http://www.jooq.org/licenses \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/src/main/resources/META-INF/README.txt b/jOOQ-examples/jOOQ-javaee-example/src/main/resources/META-INF/README.txt deleted file mode 100644 index 6fe22b8dec..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -Thanks for downloading jOOQ. -Please visit http://www.jooq.org for more information \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/src/main/resources/config.properties b/jOOQ-examples/jOOQ-javaee-example/src/main/resources/config.properties deleted file mode 100644 index 0210f258ed..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/src/main/resources/config.properties +++ /dev/null @@ -1,11 +0,0 @@ -#Database Configuration -db.driver=org.h2.Driver -db.url=jdbc:h2:~/jooq-javaee-example -db.username=sa -db.password= - -#jOOQ Configuration -jooq.sql.dialect=H2 - -#DB Schema -db.schema.script=db-h2.sql \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/src/main/resources/db-h2.sql b/jOOQ-examples/jOOQ-javaee-example/src/main/resources/db-h2.sql deleted file mode 100644 index 8815595f41..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/src/main/resources/db-h2.sql +++ /dev/null @@ -1,30 +0,0 @@ -DROP TABLE IF EXISTS book; -DROP TABLE IF EXISTS author; - -CREATE TABLE author ( - id INT NOT NULL AUTO_INCREMENT, - first_name VARCHAR(50), - last_name VARCHAR(50) NOT NULL, - date_of_birth DATE, - - CONSTRAINT pk_t_author PRIMARY KEY (ID) -); - -CREATE TABLE book ( - id INT NOT NULL AUTO_INCREMENT, - author_id INT NOT NULL, - title VARCHAR(400) NOT NULL, - published_in INT, - language_id INT, - - CONSTRAINT pk_t_book PRIMARY KEY (id), - CONSTRAINT fk_t_book_author_id FOREIGN KEY (author_id) REFERENCES author(id) ON DELETE CASCADE, -); - -INSERT INTO author VALUES (DEFAULT, 'George', 'Orwell', '1903-06-25'); -INSERT INTO author VALUES (DEFAULT, 'Paulo', 'Coelho', '1947-08-24'); - -INSERT INTO book VALUES (DEFAULT, 1, '1984', 1948, 1); -INSERT INTO book VALUES (DEFAULT, 1, 'Animal Farm', 1945, 1); -INSERT INTO book VALUES (DEFAULT, 2, 'O Alquimista', 1988, 4); -INSERT INTO book VALUES (DEFAULT, 2, 'Brida', 1990, 2); \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/src/main/resources/log4j2.xml b/jOOQ-examples/jOOQ-javaee-example/src/main/resources/log4j2.xml deleted file mode 100644 index 565e879dd7..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/src/main/resources/log4j2.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/WEB-INF/beans.xml b/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/WEB-INF/beans.xml deleted file mode 100644 index b0ba19aaf5..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/WEB-INF/beans.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/WEB-INF/faces-config.xml b/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/WEB-INF/faces-config.xml deleted file mode 100644 index 3a1d77e953..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/WEB-INF/faces-config.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/WEB-INF/jooq-javaee-example-ds.xml b/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/WEB-INF/jooq-javaee-example-ds.xml deleted file mode 100644 index 0a70a63383..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/WEB-INF/jooq-javaee-example-ds.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - jdbc:h2:~/jooq-javaee-example - org.h2.Driver - h2 - - sa - - - - \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/css/example.css b/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/css/example.css deleted file mode 100644 index 55944fc5d9..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/css/example.css +++ /dev/null @@ -1,44 +0,0 @@ -body { - margin: 0; - padding: 0; - - font-family: 'Open Sans', sans-serif; -} - -h1, h2, h3 { - padding: 10px; - margin: 0; - color: #eee; -} - -h1 { - background-color: #000; -} - -h2 { - background-color: #222; -} - -h3 { - background-color: #444; -} - -td, th { - text-align: left; - min-width: 50px; - padding: 10px; -} - -input { - min-width: 50px; -} - -input[type=submit] { - min-width: 50px; - margin-right: 10px; -} - -.div-50 { - width: 50%; - float: left; -} \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/index.html b/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/index.html deleted file mode 100644 index f3a4ef4b22..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/index.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/library.xhtml b/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/library.xhtml deleted file mode 100644 index 228229e1d3..0000000000 --- a/jOOQ-examples/jOOQ-javaee-example/src/main/webapp/library.xhtml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - -Library - - - -

Library

- -
- -
-

Authors

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Actions - - - - - - - - - - - -
- -
-

Books

- - - - - - - - - - - - - - - - Author - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Actions - - - - - - - - - - - -
-
-
- - \ No newline at end of file