Release 3.0.0-RC1 - Fixed tests against maven-generated resources

This commit is contained in:
Lukas Eder 2013-02-16 15:11:21 +01:00
parent 6babe1794e
commit f026a628ab
14 changed files with 244 additions and 1105 deletions

View File

@ -11,10 +11,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/jooq-ase"/>
<classpathentry kind="src" path="target/generated-sources/jooq-mysql"/>
<classpathentry kind="src" path="target/generated-sources/jooq-postgres"/>
<classpathentry kind="src" path="target/generated-sources/jooq-hsqldb"/>
<classpathentry kind="src" path="target/generated-sources/jooq-h2"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>

View File

@ -1,5 +1,5 @@
<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">
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>
@ -9,358 +9,163 @@
<version>3.0.0-RC1</version>
</parent>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven-example</artifactId>
<name>jOOQ Codegen Maven (Example)</name>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven-example</artifactId>
<name>jOOQ Codegen Maven (Example)</name>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.0.6.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.6.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.0.6.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.0.6.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
<scope>test</scope>
</dependency>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.168</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
<type>jar</type>
<optional>true</optional>
</dependency>
</dependencies>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.6</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.0-801.jdbc4</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.2.4</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.18</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
<type>jar</type>
<optional>true</optional>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<build>
<plugins>
<!-- The H2 test schema is loaded here -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<!-- The jOOQ code generator plugin for Postgres / Sybase ASE / MySQL -->
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<executions>
<execution>
<id>exec0</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<jdbc>
<driver>org.hsqldb.jdbcDriver</driver>
<url>jdbc:hsqldb:hsql://localhost</url>
<user>sa</user>
<password/>
</jdbc>
<generator>
<name>org.jooq.util.DefaultGenerator</name>
<database>
<name>org.jooq.util.hsqldb.HSQLDBDatabase</name>
<includes>.*</includes>
<excludes/>
<inputSchema>PUBLIC</inputSchema>
</database>
<generate>
<deprecated>false</deprecated>
</generate>
<target>
<packageName>org.jooq.util.maven.example.hsqldb</packageName>
<directory>target/generated-sources/jooq-hsqldb</directory>
</target>
</generator>
</configuration>
</execution>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.168</version>
</dependency>
</dependencies>
<execution>
<id>exec1</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<jdbc>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql:postgres</url>
<schema>public</schema>
<user>postgres</user>
<password>test</password>
</jdbc>
<generator>
<name>org.jooq.util.DefaultGenerator</name>
<database>
<name>org.jooq.util.postgres.PostgresDatabase</name>
<includes>.*</includes>
<excludes></excludes>
<dateAsTimestamp>true</dateAsTimestamp>
</database>
<generate>
<deprecated>false</deprecated>
<instanceFields>false</instanceFields>
<pojos>true</pojos>
</generate>
<target>
<packageName>org.jooq.util.maven.example.postgres</packageName>
<directory>target/generated-sources/jooq-postgres</directory>
</target>
</generator>
</configuration>
</execution>
<!-- common configuration shared by all executions -->
<configuration>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:~/maven-test</url>
<username>sa</username>
<password></password>
<!--all executions are ignored if -Dmaven.test.skip=true -->
<skip>${maven.test.skip}</skip>
</configuration>
<execution>
<id>exec2</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<jdbc>
<driver>net.sourceforge.jtds.jdbc.Driver</driver>
<url>jdbc:jtds:sybase://lukas-hp:5000/TEST</url>
<schema>dbo</schema>
<user>sa</user>
<executions>
<execution>
<id>create-database</id>
<phase>generate-sources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<autocommit>true</autocommit>
<srcFiles>
<srcFile>src/test/resources/db.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
</plugin>
<!-- [#951] This checks the possibility of empty passwords -->
<password></password>
</jdbc>
<generator>
<name>org.jooq.util.DefaultGenerator</name>
<database>
<name>org.jooq.util.ase.ASEDatabase</name>
<includes>t_.*,x_.*,v_.*,V_.*,p_.*,f_.*,(f|p)[0-9]+,s_.*</includes>
<excludes></excludes>
</database>
<generate>
<deprecated>false</deprecated>
<instanceFields>true</instanceFields>
<jpaAnnotations>true</jpaAnnotations>
</generate>
<target>
<packageName>org.jooq.util.maven.example.ase</packageName>
<directory>target/generated-sources/jooq-ase</directory>
</target>
</generator>
</configuration>
</execution>
<!-- The jOOQ code generator plugin for Postgres / Sybase ASE / MySQL -->
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>3.0.0-RC1</version>
<executions>
<execution>
<id>exec1</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<jdbc>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:~/maven-test</url>
<user>sa</user>
<password></password>
</jdbc>
<generator>
<name>org.jooq.util.DefaultGenerator</name>
<database>
<name>org.jooq.util.h2.H2Database</name>
<includes>.*</includes>
<excludes></excludes>
<dateAsTimestamp>true</dateAsTimestamp>
<inputSchema>PUBLIC</inputSchema>
</database>
<generate>
<deprecated>false</deprecated>
<instanceFields>true</instanceFields>
<pojos>true</pojos>
</generate>
<target>
<packageName>org.jooq.maven.example.h2</packageName>
<directory>target/generated-sources/jooq-h2</directory>
</target>
</generator>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.168</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<execution>
<id>exec3</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<jdbc>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost/test</url>
<user>root</user>
<password></password>
</jdbc>
<generator>
<name>org.jooq.util.DefaultGenerator</name>
<database>
<name>org.jooq.util.mysql.MySQLDatabase</name>
<includes>.*</includes>
<excludes>t_book_details</excludes>
<unsignedTypes>true</unsignedTypes>
<!-- [#958] This checks the schema-rewriting functionality -->
<inputSchema>test</inputSchema>
<outputSchema>test2</outputSchema>
<!-- [#968] custom enum types -->
<enumTypes>
<enumType>
<name>BOOLEAN_10</name>
<literals>1,0</literals>
</enumType>
<enumType>
<name>BOOLEAN_YN_UC</name>
<literals>"Y",N</literals>
</enumType>
<enumType>
<name>BOOLEAN_YN_LC</name>
<literals>y,"n"</literals>
</enumType>
<enumType>
<name>BOOLEAN_YES_NO_UC</name>
<literals>"YES","NO"</literals>
</enumType>
<enumType>
<name>BOOLEAN_YES_NO_LC</name>
<literals>yes,no</literals>
</enumType>
<enumType>
<name>BOOLEAN_TRUE_FALSE_UC</name>
<literals>TRUE,FALSE</literals>
</enumType>
<enumType>
<name>BOOLEAN_TRUE_FALSE_LC</name>
<literals>true,false</literals>
</enumType>
</enumTypes>
<!-- [#968] [#677] forced column types -->
<forcedTypes>
<forcedType>
<name>BOOLEAN_10</name>
<expressions>(?i:(.*?\.)?T_BOOLEANS\.ONE_ZERO)</expressions>
</forcedType>
<forcedType>
<name>BOOLEAN_YN_UC</name>
<expressions>(?i:(.*?\.)?T_BOOLEANS\.Y_N_UC)</expressions>
</forcedType>
<forcedType>
<name>BOOLEAN_YN_LC</name>
<expressions>(?i:(.*?\.)?T_BOOLEANS\.Y_N_LC)</expressions>
</forcedType>
<forcedType>
<name>BOOLEAN_YES_NO_UC</name>
<expressions>(?i:(.*?\.)?T_BOOLEANS\.YES_NO_UC)</expressions>
</forcedType>
<forcedType>
<name>BOOLEAN_YES_NO_LC</name>
<expressions>(?i:(.*?\.)?T_BOOLEANS\.YES_NO_LC)</expressions>
</forcedType>
<forcedType>
<name>BOOLEAN_TRUE_FALSE_UC</name>
<expressions>(?i:(.*?\.)?T_BOOLEANS\.TRUE_FALSE_UC)</expressions>
</forcedType>
<forcedType>
<name>BOOLEAN_TRUE_FALSE_LC</name>
<expressions>(?i:(.*?\.)?T_BOOLEANS\.TRUE_FALSE_LC)</expressions>
</forcedType>
</forcedTypes>
</database>
<generate>
<deprecated>false</deprecated>
<instanceFields>true</instanceFields>
<generatedAnnotation>false</generatedAnnotation>
<pojos>true</pojos>
<jpaAnnotations>true</jpaAnnotations>
</generate>
<target>
<packageName>org.jooq.util.maven.example.mysql</packageName>
<directory>target/generated-sources/jooq-mysql</directory>
</target>
</generator>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.6</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.4-702.jdbc4</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.18</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -37,42 +37,42 @@ package org.jooq.test.util.maven;
import static junit.framework.Assert.assertEquals;
import static org.jooq.impl.Factory.countDistinct;
import static org.jooq.util.maven.example.ase.Tables.T_AUTHOR;
import static org.jooq.util.maven.example.ase.Tables.T_BOOK;
import static org.jooq.util.maven.example.ase.Tables.T_BOOK_STORE;
import static org.jooq.util.maven.example.ase.Tables.T_BOOK_TO_BOOK_STORE;
import static org.jooq.maven.example.h2.Tables.T_AUTHOR;
import static org.jooq.maven.example.h2.Tables.T_BOOK;
import static org.jooq.maven.example.h2.Tables.T_BOOK_STORE;
import static org.jooq.maven.example.h2.Tables.T_BOOK_TO_BOOK_STORE;
import java.sql.Connection;
import java.sql.DriverManager;
import org.jooq.Record;
import org.jooq.Record3;
import org.jooq.Result;
import org.jooq.SQLDialect;
import org.jooq.impl.Factory;
import org.jooq.util.maven.example.ase.tables.TAuthor;
import org.jooq.util.maven.example.ase.tables.TBook;
import org.jooq.util.maven.example.ase.tables.TBookStore;
import org.jooq.util.maven.example.ase.tables.TBookToBookStore;
import org.jooq.impl.Executor;
import org.jooq.maven.example.h2.tables.TAuthor;
import org.jooq.maven.example.h2.tables.TBook;
import org.jooq.maven.example.h2.tables.TBookStore;
import org.jooq.maven.example.h2.tables.TBookToBookStore;
import org.junit.Test;
/**
* @author Lukas Eder
*/
public class TestASE {
public class TestH2 {
@Test
public void testInstanceModel() throws Exception {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:jtds:sybase://lukas-hp:5000/TEST", "sa", "");
Factory create = new Factory(connection, SQLDialect.ASE);
Class.forName("org.h2.Driver");
Connection connection = DriverManager.getConnection("jdbc:h2:~/maven-test", "sa", "");
Executor create = new Executor(connection, SQLDialect.H2);
TBook b = T_BOOK.as("b");
TAuthor a = T_AUTHOR.as("a");
TBookStore s = T_BOOK_STORE.as("s");
TBookToBookStore t = T_BOOK_TO_BOOK_STORE.as("t");
Result<Record> result =
Result<Record3<String, String, Integer>> result =
create.select(a.FIRST_NAME, a.LAST_NAME, countDistinct(s.NAME))
.from(a)
.join(b).on(b.AUTHOR_ID.equal(a.ID))

View File

@ -1,138 +0,0 @@
/**
* Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.test.util.maven;
import static junit.framework.Assert.assertEquals;
import static org.jooq.impl.Factory.countDistinct;
import static org.jooq.util.maven.example.mysql.Tables.T_AUTHOR;
import static org.jooq.util.maven.example.mysql.Tables.T_BOOK;
import static org.jooq.util.maven.example.mysql.Tables.T_BOOK_STORE;
import static org.jooq.util.maven.example.mysql.Tables.T_BOOK_TO_BOOK_STORE;
import static org.jooq.util.maven.example.mysql.Tables.T_BOOLEANS;
import java.sql.Connection;
import java.sql.DriverManager;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.SQLDialect;
import org.jooq.impl.Factory;
import org.jooq.util.maven.example.mysql.enums.BooleanTrueFalseLc;
import org.jooq.util.maven.example.mysql.enums.BooleanTrueFalseUc;
import org.jooq.util.maven.example.mysql.enums.BooleanYesNoLc;
import org.jooq.util.maven.example.mysql.enums.BooleanYesNoUc;
import org.jooq.util.maven.example.mysql.enums.BooleanYnLc;
import org.jooq.util.maven.example.mysql.enums.BooleanYnUc;
import org.jooq.util.maven.example.mysql.enums.Boolean_10;
import org.jooq.util.maven.example.mysql.tables.TAuthor;
import org.jooq.util.maven.example.mysql.tables.TBook;
import org.jooq.util.maven.example.mysql.tables.TBookStore;
import org.jooq.util.maven.example.mysql.tables.TBookToBookStore;
import org.jooq.util.maven.example.mysql.tables.records.TBooleansRecord;
import org.junit.Test;
/**
* @author Lukas Eder
*/
public class TestMySQL {
@Test
public void testInstanceModel() throws Exception {
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/test2", "root", "");
Factory create = new Factory(connection, SQLDialect.MYSQL);
TBook b = T_BOOK.as("b");
TAuthor a = T_AUTHOR.as("a");
TBookStore s = T_BOOK_STORE.as("s");
TBookToBookStore t = T_BOOK_TO_BOOK_STORE.as("t");
Result<Record> result =
create.select(a.FIRST_NAME, a.LAST_NAME, countDistinct(s.NAME))
.from(a)
.join(b).on(b.AUTHOR_ID.equal(a.ID))
.join(t).on(t.BOOK_ID.equal(b.ID))
.join(s).on(t.BOOK_STORE_NAME.equal(s.NAME))
.groupBy(a.FIRST_NAME, a.LAST_NAME)
.orderBy(countDistinct(s.NAME).desc())
.fetch();
assertEquals(2, result.size());
assertEquals("Paulo", result.getValue(0, a.FIRST_NAME));
assertEquals("George", result.getValue(1, a.FIRST_NAME));
assertEquals("Coelho", result.getValue(0, a.LAST_NAME));
assertEquals("Orwell", result.getValue(1, a.LAST_NAME));
assertEquals(Integer.valueOf(3), result.getValue(0, countDistinct(s.NAME)));
assertEquals(Integer.valueOf(2), result.getValue(1, countDistinct(s.NAME)));
}
@Test
public void testCustomEnum() throws Exception {
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/test2", "root", "");
Factory create = new Factory(connection, SQLDialect.MYSQL);
create.delete(T_BOOLEANS).execute();
assertEquals(1,
create.insertInto(T_BOOLEANS)
.set(T_BOOLEANS.ID, 1)
.set(T_BOOLEANS.ONE_ZERO, Boolean_10._0)
.set(T_BOOLEANS.TRUE_FALSE_LC, BooleanTrueFalseLc.true_)
.set(T_BOOLEANS.TRUE_FALSE_UC, BooleanTrueFalseUc.FALSE)
.set(T_BOOLEANS.Y_N_LC, BooleanYnLc.y)
.set(T_BOOLEANS.Y_N_UC, BooleanYnUc.N)
.set(T_BOOLEANS.YES_NO_LC, BooleanYesNoLc.yes)
.set(T_BOOLEANS.YES_NO_UC, BooleanYesNoUc.NO)
.execute());
TBooleansRecord bool = create.selectFrom(T_BOOLEANS).fetchOne();
assertEquals(1, (int) bool.getId());
assertEquals(Boolean_10._0, bool.getOneZero());
assertEquals(BooleanTrueFalseLc.true_, bool.getTrueFalseLc());
assertEquals(BooleanTrueFalseUc.FALSE, bool.getTrueFalseUc());
assertEquals(BooleanYnLc.y, bool.getYNLc());
assertEquals(BooleanYnUc.N, bool.getYNUc());
assertEquals(BooleanYesNoLc.yes, bool.getYesNoLc());
assertEquals(BooleanYesNoUc.NO, bool.getYesNoUc());
assertEquals(1,
create.delete(T_BOOLEANS).execute());
}
}

View File

@ -1,89 +0,0 @@
/**
* Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.test.util.maven;
import static junit.framework.Assert.assertEquals;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.List;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.SQLDialect;
import org.jooq.impl.Factory;
import org.jooq.util.maven.example.postgres.tables.TBook;
import org.jooq.util.maven.example.postgres.tables.records.TBookRecord;
import org.junit.Test;
/**
* @author Lukas Eder
*/
public class TestPostgres {
@Test
public void testFetch() throws Exception {
Connection connection = DriverManager.getConnection("jdbc:postgresql:postgres", "postgres", "test");
Factory create = new Factory(connection, SQLDialect.POSTGRES);
Result<Record> books =
create.select(TBook.ID, TBook.TITLE)
.from(TBook.T_BOOK)
.orderBy(TBook.ID)
.fetch();
assertEquals(Data.BOOK_IDS, books.getValues(0));
assertEquals(Data.BOOK_TITLES, books.getValues(1));
}
@Test
public void testFetchInto() throws Exception {
Connection connection = DriverManager.getConnection("jdbc:postgresql:postgres", "postgres", "test");
Factory create = new Factory(connection, SQLDialect.POSTGRES);
List<TBookRecord> books =
create.select(TBook.ID, TBook.TITLE)
.from(TBook.T_BOOK)
.orderBy(TBook.ID)
.fetchInto(TBookRecord.class);
for (int i = 0; i < Data.BOOK_IDS.size(); i++) {
assertEquals(Data.BOOK_IDS.get(i), books.get(i).getId());
assertEquals(Data.BOOK_TITLES.get(i), books.get(i).getTitle());
}
}
}

View File

@ -1,67 +0,0 @@
/**
* Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.test.util.spring;
import java.util.List;
import org.jooq.test.util.spring.domain.Author;
/**
* @author Sergey Epik
*/
public interface AuthorDao {
Integer add(Author author);
void addBatch(List<Author> authors);
void save(Author author);
void delete(Author author);
Author findById(Integer id);
List<Author> findAll();
long countAuthors();
long countDistinctForLastName(String name);
boolean authorExists(Integer id);
boolean authorExists(Author c);
}

View File

@ -1,152 +0,0 @@
/**
* Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.test.util.spring;
import static org.jooq.impl.Factory.param;
import static org.jooq.util.maven.example.hsqldb.Sequences.S_AUTHOR_ID;
import static org.jooq.util.maven.example.hsqldb.Tables.T_AUTHOR;
import java.util.List;
import org.jooq.BatchBindStep;
import org.jooq.FactoryOperations;
import org.jooq.impl.Factory;
import org.jooq.test.util.spring.domain.Author;
import org.jooq.util.maven.example.hsqldb.tables.records.TAuthorRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/**
* @author Sergey Epik
*/
@Transactional(readOnly = true)
@Component
public class AuthorDaoImpl implements AuthorDao {
private FactoryOperations factory;
@Autowired
public void setFactoryOperations(FactoryOperations factory) {
this.factory = factory;
}
@Override
public Author findById(Integer id) {
TAuthorRecord authorRecord = factory
.selectFrom(T_AUTHOR)
.where(T_AUTHOR.ID.equal(id))
.fetchOne();
return authorRecord == null ? null : authorRecord.into(Author.class);
}
@Override
public List<Author> findAll() {
return factory.selectFrom(T_AUTHOR).fetchInto(Author.class);
}
@Override
public Integer add(Author author) {
Integer id = factory.nextval(S_AUTHOR_ID);
factory.insertInto(T_AUTHOR)
.set(T_AUTHOR.ID, id)
.set(T_AUTHOR.FIRST_NAME, author.getFirstName())
.set(T_AUTHOR.LAST_NAME, author.getLastName())
.execute();
return id;
}
@Override
public void addBatch(List<Author> authors) {
BatchBindStep step = factory.batch(
factory.insertInto(T_AUTHOR, T_AUTHOR.ID, T_AUTHOR.FIRST_NAME, T_AUTHOR.LAST_NAME)
.values(param("id"), param("first"), param("last")));
for (Author author : authors) {
Integer id = factory.nextval(S_AUTHOR_ID).intValue();
step = step.bind(id, author.getFirstName(), author.getLastName());
}
step.execute();
}
@Override
public void save(Author author) {
factory.update(T_AUTHOR)
.set(T_AUTHOR.FIRST_NAME, author.getFirstName())
.set(T_AUTHOR.LAST_NAME, author.getLastName())
.where(T_AUTHOR.ID.equal(author.getId()))
.execute();
}
@Override
public void delete(Author author) {
factory.delete(T_AUTHOR)
.where(T_AUTHOR.ID.equal(author.getId()))
.execute();
}
@Override
public long countAuthors() {
return factory.selectCount().from(T_AUTHOR)
.fetchOne().getValue(0, Long.class);
}
@Override
public long countDistinctForLastName(String name) {
return factory.select(Factory.countDistinct(T_AUTHOR.LAST_NAME))
.from(T_AUTHOR)
.where(T_AUTHOR.LAST_NAME.like(name + "%"))
.fetchOne()
.getValue(0, Long.class);
}
@Override
public boolean authorExists(Integer id) {
return factory.selectFrom(T_AUTHOR).where(T_AUTHOR.ID.equal(id)).fetchOne() != null;
}
@Override
public boolean authorExists(Author author) {
return factory.selectFrom(T_AUTHOR)
.where(T_AUTHOR.ID.equal(author.getId()))
.fetchOne() != null;
}
}

View File

@ -1,172 +0,0 @@
/**
* Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.test.util.spring;
import java.util.ArrayList;
import java.util.List;
import junit.framework.Assert;
import org.jooq.test.util.spring.domain.Author;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
/**
* @author Sergey Epik
*/
@ContextConfiguration(locations = "classpath:spring-context.xml")
@RunWith(SpringJUnit4ClassRunner.class)
public class AuthorDaoTest {
@Autowired
private AuthorDao authorDao;
@Test
public void testFindAll() {
List<Author> authors = authorDao.findAll();
Assert.assertEquals(2, authors.size());
}
@Test
public void testFindById() {
Author a = authorDao.findById(1);
Assert.assertEquals("George", a.getFirstName());
}
@Transactional
@Test
public void testAdd() {
Author a = new Author();
a.setFirstName("Lewis");
a.setLastName("Carroll");
authorDao.add(a);
List<Author> authors = authorDao.findAll();
Assert.assertEquals(3, authors.size());
}
@Transactional
@Test
public void testAddBatch() {
List<Author> authors = new ArrayList<Author>();
Author a1 = new Author();
a1.setFirstName("Lewis");
a1.setLastName("Carroll");
authors.add(a1);
Author a2 = new Author();
a2.setFirstName("Agatha");
a2.setLastName("Christie");
authors.add(a2);
Author a3 = new Author();
a3.setFirstName("Charles");
a3.setLastName("Dickens");
authors.add(a3);
Author a4 = new Author();
a4.setFirstName("Mark");
a4.setLastName("Twain");
authors.add(a4);
authorDao.addBatch(authors);
List<Author> results = authorDao.findAll();
Assert.assertEquals(6, results.size());
}
@Transactional
@Test
public void testSaveAuthor() {
Author author = authorDao.findById(1);
author.setFirstName("Arthur Conan");
author.setLastName("Doyle");
authorDao.save(author);
Author found = authorDao.findById(1);
Assert.assertEquals("Arthur Conan", found.getFirstName());
}
@Transactional
@Test
public void testDeleteAuthor() {
Author c = authorDao.findById(1);
authorDao.delete(c);
List<Author> authors = authorDao.findAll();
Assert.assertEquals(1, authors.size());
}
@Transactional
@Test
public void testCountAuthor() {
Author a = new Author();
a.setFirstName("Lewis");
a.setLastName("Carroll");
authorDao.add(a);
long count = authorDao.countAuthors();
List<Author> authors = authorDao.findAll();
for (Author author : authors) {
System.out.println(author.getFirstName());
}
Assert.assertEquals(3, count);
}
@Transactional
@Test
public void testCountDistinctAuthor() {
Author a1 = new Author();
a1.setFirstName("Calvin");
a1.setLastName("Coolidge");
authorDao.add(a1);
Author a2 = new Author();
a2.setFirstName("James Fenimore");
a2.setLastName("Cooper");
authorDao.add(a2);
long count = authorDao.countDistinctForLastName("Coo");
Assert.assertEquals(2, count);
}
@Test
public void testAuthorExists() {
Author c = authorDao.findById(1);
boolean exists = authorDao.authorExists(c);
Assert.assertTrue(exists);
}
@Test
public void testAuthorNotExists() {
boolean exists = authorDao.authorExists(1000);
Assert.assertFalse(exists);
}
}

View File

@ -1,70 +0,0 @@
/**
* Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.test.util.spring.domain;
/**
* @author Sergey Epik
*/
public class Author {
private Integer id;
private String firstName;
private String lastName;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}

View File

@ -1,15 +0,0 @@
CREATE TABLE t_author (
ID INT,
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 SEQUENCE s_author_id START WITH 1;
INSERT INTO t_author (ID, FIRST_NAME, LAST_NAME) VALUES (next value for s_author_id, 'George', 'Orwell');
INSERT INTO t_author (ID, FIRST_NAME, LAST_NAME) VALUES (next value for s_author_id, 'Paulo', 'Coelho');

View File

@ -0,0 +1,77 @@
DROP TABLE IF EXISTS t_book_to_book_store;
DROP TABLE IF EXISTS t_book_store;
DROP TABLE IF EXISTS t_book;
DROP TABLE IF EXISTS t_author;
DROP SEQUENCE IF EXISTS s_author_id;
CREATE SEQUENCE s_author_id START WITH 1;
CREATE TABLE t_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 t_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 NOT NULL,
language_id INT NOT NULL,
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 t_author(id),
CONSTRAINT fk_t_book_co_author_id FOREIGN KEY (co_author_id) REFERENCES t_author(id)
);
CREATE TABLE t_book_store (
name VARCHAR(400) NOT NULL,
CONSTRAINT uk_t_book_store_name PRIMARY KEY(name)
);
CREATE TABLE t_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 t_book_store (name)
ON DELETE CASCADE,
CONSTRAINT fk_b2bs_b_id FOREIGN KEY (book_id)
REFERENCES t_book (id)
ON DELETE CASCADE
);
INSERT INTO t_author VALUES (next value for s_author_id, 'George', 'Orwell', '1903-06-25', 1903, null);
INSERT INTO t_author VALUES (next value for s_author_id, 'Paulo', 'Coelho', '1947-08-24', 1947, null);
INSERT INTO t_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 t_book VALUES (2, 1, null, null, 'Animal Farm', 1945, 1, null, null, null, '2010-01-01 00:00:00');
INSERT INTO t_book VALUES (3, 2, null, null, 'O Alquimista', 1988, 4, null, null, 1, null);
INSERT INTO t_book VALUES (4, 2, null, null, 'Brida', 1990, 2, null, null, null, null);
INSERT INTO t_book_store (name) VALUES
('Orell Füssli'),
('Ex Libris'),
('Buchhandlung im Volkshaus');
INSERT INTO t_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);

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<tx:annotation-driven transaction-manager="transactionManager"/>
<jdbc:embedded-database id="dataSource" type="HSQL">
<jdbc:script location="classpath:db-init.sql"/>
</jdbc:embedded-database>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="transactionAwareDataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
<constructor-arg ref="dataSource"/>
</bean>
<bean id="factoryProxy" class="org.jooq.impl.Factory">
<constructor-arg name="datasource" ref="transactionAwareDataSource"/>
<constructor-arg name="dialect">
<value type="org.jooq.SQLDialect">HSQLDB</value>
</constructor-arg>
</bean>
<context:component-scan base-package="org.jooq.test.util.spring"/>
</beans>

View File

@ -50,7 +50,7 @@
<executions>
<execution>
<id>create-database</id>
<phase>process-test-resources</phase>
<phase>generate-sources</phase>
<goals>
<goal>execute</goal>
</goals>

View File

@ -61,8 +61,6 @@ import java.util.UUID;
import javax.swing.UIManager;
import junit.framework.Assert;
import org.jooq.ArrayRecord;
import org.jooq.DAO;
import org.jooq.DataType;