Implement snapshot tests for generated code

This commit is contained in:
Travis Burtrum 2019-02-09 23:37:17 -05:00
parent 89966a616d
commit 46a37f6571
43 changed files with 34365 additions and 3 deletions

View File

@ -32,7 +32,7 @@ before_script:
script: script:
- docker ps -a - docker ps -a
# java8+ supports everything # java8+ supports everything
- mvn -B -pl '!test' clean install || travis_terminate 1; - ./test/runSnapshotTests.sh || travis_terminate 1;
# everything against BIND # 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; - 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 # everything against BIND jdbcMapper, but OPTIMAL queryMapper
@ -55,7 +55,7 @@ matrix:
script: script:
# java6 doesn't support ms-sql at all, and doesn't support h2 with ANY # java6 doesn't support ms-sql at all, and doesn't support h2 with ANY
- .travis/dl_java6_maven.sh - .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 --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=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; - mvn --offline -B -pl test clean test -DjdbcMapper.databaseType=ANY '-DjdbcUrl=jdbc:postgresql:test_db' || travis_terminate 1;
@ -65,7 +65,7 @@ matrix:
jdk: openjdk7 jdk: openjdk7
script: script:
# java7 doesn't support h2 with ANY # 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 --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=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; - mvn -B -pl test clean test -DjdbcMapper.databaseType=ANY '-DjdbcUrl=jdbc:postgresql:test_db' || travis_terminate 1;

18
test/runSnapshotTests.sh Executable file
View File

@ -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

View File

@ -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);
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff