Browse Source

Implement snapshot tests for generated code

dependabot/maven/junit-junit-4.13.1
Travis Burtrum 4 years ago
parent
commit
46a37f6571
  1. 6
      .travis.yml
  2. 18
      test/runSnapshotTests.sh
  3. 97
      test/src/test/java/com/moparisthebest/jdbc/codegen/SnapshotTest.java
  4. 79
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/AbstractDaoAnyBean.java
  5. 79
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/AbstractDaoBean.java
  6. 79
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/AbstractDaoBindBean.java
  7. 79
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/AbstractDaoOracleBean.java
  8. 79
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/AbstractDaoUnNestBean.java
  9. 54
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/CleaningPersonDaoAnyBean.java
  10. 54
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/CleaningPersonDaoBean.java
  11. 54
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/CleaningPersonDaoBindBean.java
  12. 54
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/CleaningPersonDaoOracleBean.java
  13. 54
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/CleaningPersonDaoUnNestBean.java
  14. 2013
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/PersonDAOAnyBean.java
  15. 2013
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/PersonDAOBean.java
  16. 2013
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/PersonDAOBindBean.java
  17. 2013
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/PersonDAOOracleBean.java
  18. 2013
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/PersonDAOUnNestBean.java
  19. 1604
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/QmDaoAnyBean.java
  20. 1602
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/QmDaoBean.java
  21. 1602
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/QmDaoBindBean.java
  22. 1604
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/QmDaoOracleBean.java
  23. 1604
      test/src/test/snapshot/com/moparisthebest/jdbc/codegen/QmDaoUnNestBean.java
  24. 74
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/AbstractDaoAnyBean.java
  25. 74
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/AbstractDaoBean.java
  26. 74
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/AbstractDaoBindBean.java
  27. 74
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/AbstractDaoOracleBean.java
  28. 74
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/AbstractDaoUnNestBean.java
  29. 54
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/CleaningPersonDaoAnyBean.java
  30. 54
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/CleaningPersonDaoBean.java
  31. 54
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/CleaningPersonDaoBindBean.java
  32. 54
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/CleaningPersonDaoOracleBean.java
  33. 54
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/CleaningPersonDaoUnNestBean.java
  34. 1652
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/PersonDAOAnyBean.java
  35. 1652
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/PersonDAOBean.java
  36. 1652
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/PersonDAOBindBean.java
  37. 1652
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/PersonDAOOracleBean.java
  38. 1652
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/PersonDAOUnNestBean.java
  39. 1321
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/QmDaoAnyBean.java
  40. 1319
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/QmDaoBean.java
  41. 1319
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/QmDaoBindBean.java
  42. 1321
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/QmDaoOracleBean.java
  43. 1321
      test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/QmDaoUnNestBean.java

6
.travis.yml

@ -32,7 +32,7 @@ before_script: @@ -32,7 +32,7 @@ before_script:
script:
- docker ps -a
# java8+ supports everything
- mvn -B -pl '!test' clean install || travis_terminate 1;
- ./test/runSnapshotTests.sh || travis_terminate 1;
# everything against BIND
- mvn -B -pl test clean test -DjdbcMapper.databaseType=BIND --settings .travis-settings.xml -P oracle '-DjdbcUrl1=jdbc:postgresql:test_db' '-DjdbcUrl2=jdbc:mariadb://127.0.0.1:3306/test_db?user=root' '-DjdbcUrl3=jdbc:oracle:thin:travis_test/travis_test@127.0.0.1:1521/xe' '-DjdbcUrl4=jdbc:sqlserver://localhost:1433;databaseName=master;username=sa;password=<YourStrong!Passw0rd>;' || travis_terminate 1;
# everything against BIND jdbcMapper, but OPTIMAL queryMapper
@ -55,7 +55,7 @@ matrix: @@ -55,7 +55,7 @@ matrix:
script:
# java6 doesn't support ms-sql at all, and doesn't support h2 with ANY
- .travis/dl_java6_maven.sh
- mvn --offline -B -pl '!test' clean install || travis_terminate 1;
- ./test/runSnapshotTests.sh --offline || travis_terminate 1;
- mvn --offline -B -pl test clean test -DjdbcMapper.databaseType=BIND --settings .travis-settings.xml -P oracle '-DjdbcUrl1=jdbc:postgresql:test_db' '-DjdbcUrl2=jdbc:mariadb://127.0.0.1:3306/test_db?user=root' '-DjdbcUrl3=jdbc:oracle:thin:travis_test/travis_test@127.0.0.1:1521/xe' || travis_terminate 1;
- mvn --offline -B -pl test clean test -DjdbcMapper.databaseType=BIND -DqueryMapper.databaseType=OPTIMAL --settings .travis-settings.xml -P oracle '-DjdbcUrl1=jdbc:postgresql:test_db' '-DjdbcUrl2=jdbc:mariadb://127.0.0.1:3306/test_db?user=root' '-DjdbcUrl3=jdbc:oracle:thin:travis_test/travis_test@127.0.0.1:1521/xe' || travis_terminate 1;
- mvn --offline -B -pl test clean test -DjdbcMapper.databaseType=ANY '-DjdbcUrl=jdbc:postgresql:test_db' || travis_terminate 1;
@ -65,7 +65,7 @@ matrix: @@ -65,7 +65,7 @@ matrix:
jdk: openjdk7
script:
# java7 doesn't support h2 with ANY
- mvn -B -pl '!test' clean install || travis_terminate 1;
- ./test/runSnapshotTests.sh || travis_terminate 1;
- mvn -B -pl test clean test -DjdbcMapper.databaseType=BIND --settings .travis-settings.xml -P oracle '-DjdbcUrl1=jdbc:postgresql:test_db' '-DjdbcUrl2=jdbc:mariadb://127.0.0.1:3306/test_db?user=root' '-DjdbcUrl3=jdbc:oracle:thin:travis_test/travis_test@127.0.0.1:1521/xe' '-DjdbcUrl4=jdbc:sqlserver://localhost:1433;databaseName=master;username=sa;password=<YourStrong!Passw0rd>;' || travis_terminate 1;
- mvn -B -pl test clean test -DjdbcMapper.databaseType=BIND -DqueryMapper.databaseType=OPTIMAL --settings .travis-settings.xml -P oracle '-DjdbcUrl1=jdbc:postgresql:test_db' '-DjdbcUrl2=jdbc:mariadb://127.0.0.1:3306/test_db?user=root' '-DjdbcUrl3=jdbc:oracle:thin:travis_test/travis_test@127.0.0.1:1521/xe' '-DjdbcUrl4=jdbc:sqlserver://localhost:1433;databaseName=master;username=sa;password=<YourStrong!Passw0rd>;' || travis_terminate 1;
- mvn -B -pl test clean test -DjdbcMapper.databaseType=ANY '-DjdbcUrl=jdbc:postgresql:test_db' || travis_terminate 1;

18
test/runSnapshotTests.sh

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
#!/bin/sh
set -e
updateSnapshots=false
if [ "$1" == "--update" ]
then
updateSnapshots=true
shift
fi
mvn="mvn -B -pl test clean test -Dtest=SnapshotTest -DupdateSnapshots=$updateSnapshots"
mvn "$@" -B -pl '!test' clean install
$mvn "$@" -DJdbcMapper.beanSuffix=Bean
$mvn "$@" -DjdbcMapper.databaseType=BIND -DJdbcMapper.beanSuffix=BindBean
$mvn "$@" -DjdbcMapper.databaseType=ANY -DJdbcMapper.beanSuffix=AnyBean
$mvn "$@" -DjdbcMapper.databaseType=UNNEST -DJdbcMapper.beanSuffix=UnNestBean
$mvn "$@" -DjdbcMapper.databaseType=ORACLE -P oracle -DJdbcMapper.beanSuffix=OracleBean

97
test/src/test/java/com/moparisthebest/jdbc/codegen/SnapshotTest.java

@ -0,0 +1,97 @@ @@ -0,0 +1,97 @@
package com.moparisthebest.jdbc.codegen;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.charset.Charset;
import static com.moparisthebest.jdbc.TryClose.tryClose;
import static org.junit.Assert.assertEquals;
public class SnapshotTest {
// we want to only run this when explicitly asked to by runSnapshotTests.sh, which carefully exercises all options
private final static boolean skipSnapshotTest = !"SnapshotTest".equals(System.getProperty("test"));
private final static boolean updateSnapshots = Boolean.parseBoolean(System.getProperty("updateSnapshots", "false"));
//IFJAVA8_START
private static final String snapshotPrefix = "src/test/snapshot/";
//IFJAVA8_END
/*IFJAVA6_START
private static final String snapshotPrefix = "src/test/snapshot/jdk6/";
IFJAVA6_END*/
@Test
public void testAbstractDao() throws IOException {
testFile(AbstractDao.class);
}
@Test
public void testCleaningPersonDao() throws IOException {
testFile(CleaningPersonDao.class);
}
@Test
public void testPersonDAO() throws IOException {
testFile(PersonDAO.class);
}
@Test
public void testQmDao() throws IOException {
testFile(QmDao.class);
}
static void testFile(final Class<?> testClass) throws IOException {
testFile(testClass.getName());
}
static void testFile(final String className) throws IOException {
if(skipSnapshotTest)
return; // skip
final String javaName = className.replace('.', '/') + JdbcMapper.beanSuffix + ".java";
final String snapshotName = snapshotPrefix + javaName;
final String generatedName = "target/generated-sources/annotations/" + javaName;
if (updateSnapshots) {
final byte[] generatedBytes = readAllBytes(generatedName);
writeFile(snapshotName, generatedBytes);
} else {
final String snapshotContents = readUtf8File(snapshotName);
final String generatedContents = readUtf8File(generatedName);
assertEquals(snapshotContents, generatedContents);
}
}
static void writeFile(final String fileName, final byte[] bytes) throws IOException {
RandomAccessFile f = null;
try {
final File fileToWrite = new File(fileName);
fileToWrite.getParentFile().mkdirs();
f = new RandomAccessFile(fileToWrite, "rw");
f.write(bytes);
f.setLength(bytes.length);
} finally {
tryClose(f);
}
}
static byte[] readAllBytes(final String fileName) throws IOException {
RandomAccessFile f = null;
try {
f = new RandomAccessFile(fileName, "r");
final byte[] ret = new byte[(int) f.length()];
f.readFully(ret);
return ret;
} finally {
tryClose(f);
}
}
private static final Charset UTF_8 = Charset.forName("UTF-8");
static String readUtf8File(final String fileName) throws IOException {
return new String(readAllBytes(fileName), UTF_8);
}
}

79
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/AbstractDaoAnyBean.java

@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class AbstractDaoAnyBean extends AbstractDao {
private final Connection conn;
private final boolean closeConn;
private AbstractDaoAnyBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public AbstractDaoAnyBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return ret;
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public long getPersonNo(final java.lang.String lastName) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no FROM person WHERE last_name = ?");
ps.setObject(1, lastName);
rs = ps.executeQuery();
if(rs.next()) {
final long ret = rs.getLong(1);
return ret;
} else {
return 0;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public com.moparisthebest.jdbc.dto.Person getPersonInTransaction(final java.lang.String lastName) throws java.sql.SQLException {
return com.moparisthebest.jdbc.QueryRunner.runConnectionInTransaction(this.conn, dao -> super.getPersonInTransaction(lastName));
}
}

79
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/AbstractDaoBean.java

@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class AbstractDaoBean extends AbstractDao {
private final Connection conn;
private final boolean closeConn;
private AbstractDaoBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public AbstractDaoBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return ret;
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public long getPersonNo(final java.lang.String lastName) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no FROM person WHERE last_name = ?");
ps.setObject(1, lastName);
rs = ps.executeQuery();
if(rs.next()) {
final long ret = rs.getLong(1);
return ret;
} else {
return 0;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public com.moparisthebest.jdbc.dto.Person getPersonInTransaction(final java.lang.String lastName) throws java.sql.SQLException {
return com.moparisthebest.jdbc.QueryRunner.runConnectionInTransaction(this.conn, dao -> super.getPersonInTransaction(lastName));
}
}

79
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/AbstractDaoBindBean.java

@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class AbstractDaoBindBean extends AbstractDao {
private final Connection conn;
private final boolean closeConn;
private AbstractDaoBindBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public AbstractDaoBindBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return ret;
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public long getPersonNo(final java.lang.String lastName) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no FROM person WHERE last_name = ?");
ps.setObject(1, lastName);
rs = ps.executeQuery();
if(rs.next()) {
final long ret = rs.getLong(1);
return ret;
} else {
return 0;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public com.moparisthebest.jdbc.dto.Person getPersonInTransaction(final java.lang.String lastName) throws java.sql.SQLException {
return com.moparisthebest.jdbc.QueryRunner.runConnectionInTransaction(this.conn, dao -> super.getPersonInTransaction(lastName));
}
}

79
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/AbstractDaoOracleBean.java

@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class AbstractDaoOracleBean extends AbstractDao {
private final Connection conn;
private final boolean closeConn;
private AbstractDaoOracleBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public AbstractDaoOracleBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return ret;
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public long getPersonNo(final java.lang.String lastName) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no FROM person WHERE last_name = ?");
ps.setObject(1, lastName);
rs = ps.executeQuery();
if(rs.next()) {
final long ret = rs.getLong(1);
return ret;
} else {
return 0;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public com.moparisthebest.jdbc.dto.Person getPersonInTransaction(final java.lang.String lastName) throws java.sql.SQLException {
return com.moparisthebest.jdbc.QueryRunner.runConnectionInTransaction(this.conn, dao -> super.getPersonInTransaction(lastName));
}
}

79
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/AbstractDaoUnNestBean.java

@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class AbstractDaoUnNestBean extends AbstractDao {
private final Connection conn;
private final boolean closeConn;
private AbstractDaoUnNestBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public AbstractDaoUnNestBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return ret;
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public long getPersonNo(final java.lang.String lastName) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no FROM person WHERE last_name = ?");
ps.setObject(1, lastName);
rs = ps.executeQuery();
if(rs.next()) {
final long ret = rs.getLong(1);
return ret;
} else {
return 0;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public com.moparisthebest.jdbc.dto.Person getPersonInTransaction(final java.lang.String lastName) throws java.sql.SQLException {
return com.moparisthebest.jdbc.QueryRunner.runConnectionInTransaction(this.conn, dao -> super.getPersonInTransaction(lastName));
}
}

54
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/CleaningPersonDaoAnyBean.java

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class CleaningPersonDaoAnyBean implements CleaningPersonDao {
private final Connection conn;
private final boolean closeConn;
private CleaningPersonDaoAnyBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public CleaningPersonDaoAnyBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo, final com.moparisthebest.jdbc.Cleaner<com.moparisthebest.jdbc.dto.FieldPerson> personCleaner) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return personCleaner == null ? ret : personCleaner.clean(ret);
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
}

54
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/CleaningPersonDaoBean.java

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class CleaningPersonDaoBean implements CleaningPersonDao {
private final Connection conn;
private final boolean closeConn;
private CleaningPersonDaoBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public CleaningPersonDaoBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo, final com.moparisthebest.jdbc.Cleaner<com.moparisthebest.jdbc.dto.FieldPerson> personCleaner) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return personCleaner == null ? ret : personCleaner.clean(ret);
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
}

54
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/CleaningPersonDaoBindBean.java

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class CleaningPersonDaoBindBean implements CleaningPersonDao {
private final Connection conn;
private final boolean closeConn;
private CleaningPersonDaoBindBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public CleaningPersonDaoBindBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo, final com.moparisthebest.jdbc.Cleaner<com.moparisthebest.jdbc.dto.FieldPerson> personCleaner) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return personCleaner == null ? ret : personCleaner.clean(ret);
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
}

54
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/CleaningPersonDaoOracleBean.java

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class CleaningPersonDaoOracleBean implements CleaningPersonDao {
private final Connection conn;
private final boolean closeConn;
private CleaningPersonDaoOracleBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public CleaningPersonDaoOracleBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo, final com.moparisthebest.jdbc.Cleaner<com.moparisthebest.jdbc.dto.FieldPerson> personCleaner) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return personCleaner == null ? ret : personCleaner.clean(ret);
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
}

54
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/CleaningPersonDaoUnNestBean.java

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class CleaningPersonDaoUnNestBean implements CleaningPersonDao {
private final Connection conn;
private final boolean closeConn;
private CleaningPersonDaoUnNestBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public CleaningPersonDaoUnNestBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo, final com.moparisthebest.jdbc.Cleaner<com.moparisthebest.jdbc.dto.FieldPerson> personCleaner) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return personCleaner == null ? ret : personCleaner.clean(ret);
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
}

2013
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/PersonDAOAnyBean.java

File diff suppressed because it is too large Load Diff

2013
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/PersonDAOBean.java

File diff suppressed because it is too large Load Diff

2013
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/PersonDAOBindBean.java

File diff suppressed because it is too large Load Diff

2013
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/PersonDAOOracleBean.java

File diff suppressed because it is too large Load Diff

2013
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/PersonDAOUnNestBean.java

File diff suppressed because it is too large Load Diff

1604
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/QmDaoAnyBean.java

File diff suppressed because it is too large Load Diff

1602
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/QmDaoBean.java

File diff suppressed because it is too large Load Diff

1602
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/QmDaoBindBean.java

File diff suppressed because it is too large Load Diff

1604
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/QmDaoOracleBean.java

File diff suppressed because it is too large Load Diff

1604
test/src/test/snapshot/com/moparisthebest/jdbc/codegen/QmDaoUnNestBean.java

File diff suppressed because it is too large Load Diff

74
test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/AbstractDaoAnyBean.java

@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class AbstractDaoAnyBean extends AbstractDao {
private final Connection conn;
private final boolean closeConn;
private AbstractDaoAnyBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public AbstractDaoAnyBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return ret;
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public long getPersonNo(final java.lang.String lastName) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no FROM person WHERE last_name = ?");
ps.setObject(1, lastName);
rs = ps.executeQuery();
if(rs.next()) {
final long ret = rs.getLong(1);
return ret;
} else {
return 0;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
}

74
test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/AbstractDaoBean.java

@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class AbstractDaoBean extends AbstractDao {
private final Connection conn;
private final boolean closeConn;
private AbstractDaoBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public AbstractDaoBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return ret;
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public long getPersonNo(final java.lang.String lastName) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no FROM person WHERE last_name = ?");
ps.setObject(1, lastName);
rs = ps.executeQuery();
if(rs.next()) {
final long ret = rs.getLong(1);
return ret;
} else {
return 0;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
}

74
test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/AbstractDaoBindBean.java

@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class AbstractDaoBindBean extends AbstractDao {
private final Connection conn;
private final boolean closeConn;
private AbstractDaoBindBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public AbstractDaoBindBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return ret;
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public long getPersonNo(final java.lang.String lastName) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no FROM person WHERE last_name = ?");
ps.setObject(1, lastName);
rs = ps.executeQuery();
if(rs.next()) {
final long ret = rs.getLong(1);
return ret;
} else {
return 0;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
}

74
test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/AbstractDaoOracleBean.java

@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class AbstractDaoOracleBean extends AbstractDao {
private final Connection conn;
private final boolean closeConn;
private AbstractDaoOracleBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public AbstractDaoOracleBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return ret;
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public long getPersonNo(final java.lang.String lastName) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no FROM person WHERE last_name = ?");
ps.setObject(1, lastName);
rs = ps.executeQuery();
if(rs.next()) {
final long ret = rs.getLong(1);
return ret;
} else {
return 0;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
}

74
test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/AbstractDaoUnNestBean.java

@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class AbstractDaoUnNestBean extends AbstractDao {
private final Connection conn;
private final boolean closeConn;
private AbstractDaoUnNestBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public AbstractDaoUnNestBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return ret;
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
@Override
public long getPersonNo(final java.lang.String lastName) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no FROM person WHERE last_name = ?");
ps.setObject(1, lastName);
rs = ps.executeQuery();
if(rs.next()) {
final long ret = rs.getLong(1);
return ret;
} else {
return 0;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
}

54
test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/CleaningPersonDaoAnyBean.java

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class CleaningPersonDaoAnyBean implements CleaningPersonDao {
private final Connection conn;
private final boolean closeConn;
private CleaningPersonDaoAnyBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public CleaningPersonDaoAnyBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo, final com.moparisthebest.jdbc.Cleaner<com.moparisthebest.jdbc.dto.FieldPerson> personCleaner) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return personCleaner == null ? ret : personCleaner.clean(ret);
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
}

54
test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/CleaningPersonDaoBean.java

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class CleaningPersonDaoBean implements CleaningPersonDao {
private final Connection conn;
private final boolean closeConn;
private CleaningPersonDaoBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public CleaningPersonDaoBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
@Override
public com.moparisthebest.jdbc.dto.FieldPerson getPerson(final long personNo, final com.moparisthebest.jdbc.Cleaner<com.moparisthebest.jdbc.dto.FieldPerson> personCleaner) throws java.sql.SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = ?");
ps.setObject(1, personNo);
rs = ps.executeQuery();
if(rs.next()) {
final com.moparisthebest.jdbc.dto.FieldPerson ret = new com.moparisthebest.jdbc.dto.FieldPerson(
rs.getLong(1),
com.moparisthebest.jdbc.util.ResultSetUtil.getUtilDate(rs, 4),
rs.getString(2),
rs.getString(3));
return personCleaner == null ? ret : personCleaner.clean(ret);
} else {
return null;
}
} finally {
tryClose(rs);
tryClose(ps);
}
}
}

54
test/src/test/snapshot/jdk6/com/moparisthebest/jdbc/codegen/CleaningPersonDaoBindBean.java

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
package com.moparisthebest.jdbc.codegen;
import com.moparisthebest.jdbc.Factory;
import java.sql.*;
import static com.moparisthebest.jdbc.util.ResultSetUtil.*;
import static com.moparisthebest.jdbc.TryClose.tryClose;
public class CleaningPersonDaoBindBean implements CleaningPersonDao {
private final Connection conn;
private final boolean closeConn;
private CleaningPersonDaoBindBean(final Connection conn, final boolean closeConn) {
this.conn = conn;
this.closeConn = closeConn;
if (this.conn == null)
throw new NullPointerException("Connection needs to be non-null for JdbcMapper...");
}
public CleaningPersonDaoBindBean(Connection conn) {
this(conn, false);
}
public Connection getConnection() {
return this.conn;
}
<