use of mbg.test.ib2j2.generated.conditional.dao.AwfulTableDAO in project generator by mybatis.
the class ConditionalJava5Test method testAwfulTableInsert.
@Test
public void testAwfulTableInsert() {
AwfulTableDAO dao = getAwfulTableDAO();
try {
AwfulTable record = new AwfulTable();
record.seteMail("fred@fred.com");
record.setEmailaddress("alsofred@fred.com");
record.setFirstFirstName("fred1");
record.setFrom("from field");
record.setId1(1);
record.setId2(2);
record.setId5(5);
record.setId6(6);
record.setId7(7);
record.setSecondFirstName("fred2");
record.setThirdFirstName("fred3");
Integer generatedCustomerId = dao.insert(record);
assertEquals(57, generatedCustomerId.intValue());
AwfulTable returnedRecord = dao.selectByPrimaryKey(generatedCustomerId);
assertEquals(generatedCustomerId, returnedRecord.getCustomerId());
assertEquals(record.geteMail(), returnedRecord.geteMail());
assertEquals(record.getEmailaddress(), returnedRecord.getEmailaddress());
assertEquals(record.getFirstFirstName(), returnedRecord.getFirstFirstName());
assertEquals(record.getFrom(), returnedRecord.getFrom());
assertEquals(record.getId1(), returnedRecord.getId1());
assertEquals(record.getId2(), returnedRecord.getId2());
assertEquals(record.getId5(), returnedRecord.getId5());
assertEquals(record.getId6(), returnedRecord.getId6());
assertEquals(record.getId7(), returnedRecord.getId7());
assertEquals(record.getSecondFirstName(), returnedRecord.getSecondFirstName());
assertEquals(record.getThirdFirstName(), returnedRecord.getThirdFirstName());
} catch (SQLException e) {
fail(e.getMessage());
}
}
use of mbg.test.ib2j2.generated.conditional.dao.AwfulTableDAO in project generator by mybatis.
the class ConditionalJava5Test method testAwfulTableUpdateByPrimaryKeySelective.
@Test
public void testAwfulTableUpdateByPrimaryKeySelective() {
AwfulTableDAO dao = getAwfulTableDAO();
try {
AwfulTable record = new AwfulTable();
record.seteMail("fred@fred.com");
record.setEmailaddress("alsofred@fred.com");
record.setFirstFirstName("fred1");
record.setFrom("from field");
record.setId1(1);
record.setId2(2);
record.setId5(5);
record.setId6(6);
record.setId7(7);
record.setSecondFirstName("fred2");
record.setThirdFirstName("fred3");
Integer generatedCustomerId = dao.insert(record);
AwfulTable newRecord = new AwfulTable();
newRecord.setCustomerId(generatedCustomerId);
newRecord.setId1(11);
newRecord.setId2(22);
int rows = dao.updateByPrimaryKeySelective(newRecord);
assertEquals(1, rows);
AwfulTable returnedRecord = dao.selectByPrimaryKey(generatedCustomerId);
assertEquals(generatedCustomerId, returnedRecord.getCustomerId());
assertEquals(record.geteMail(), returnedRecord.geteMail());
assertEquals(record.getEmailaddress(), returnedRecord.getEmailaddress());
assertEquals(record.getFirstFirstName(), returnedRecord.getFirstFirstName());
assertEquals(record.getFrom(), returnedRecord.getFrom());
assertEquals(newRecord.getId1(), returnedRecord.getId1());
assertEquals(newRecord.getId2(), returnedRecord.getId2());
assertEquals(record.getId5(), returnedRecord.getId5());
assertEquals(record.getId6(), returnedRecord.getId6());
assertEquals(record.getId7(), returnedRecord.getId7());
assertEquals(record.getSecondFirstName(), returnedRecord.getSecondFirstName());
assertEquals(record.getThirdFirstName(), returnedRecord.getThirdFirstName());
} catch (SQLException e) {
fail(e.getMessage());
}
}
use of mbg.test.ib2j2.generated.conditional.dao.AwfulTableDAO in project generator by mybatis.
the class ConditionalJava5Test method testAwfulTableDeleteByPrimaryKey.
@Test
public void testAwfulTableDeleteByPrimaryKey() {
AwfulTableDAO dao = getAwfulTableDAO();
try {
AwfulTable record = new AwfulTable();
record.seteMail("fred@fred.com");
record.setEmailaddress("alsofred@fred.com");
record.setFirstFirstName("fred1");
record.setFrom("from field");
record.setId1(1);
record.setId2(2);
record.setId5(5);
record.setId6(6);
record.setId7(7);
record.setSecondFirstName("fred2");
record.setThirdFirstName("fred3");
Integer generatedCustomerId = dao.insert(record);
int rows = dao.deleteByPrimaryKey(generatedCustomerId);
assertEquals(1, rows);
AwfulTableExample example = new AwfulTableExample();
List<AwfulTable> answer = dao.selectByExample(example);
assertEquals(0, answer.size());
} catch (SQLException e) {
fail(e.getMessage());
}
}
use of mbg.test.ib2j2.generated.conditional.dao.AwfulTableDAO in project generator by mybatis.
the class HierarchicalJava2Test method testAwfulTableUpdateByPrimaryKeySelective.
public void testAwfulTableUpdateByPrimaryKeySelective() {
AwfulTableDAO dao = getAwfulTableDAO();
try {
AwfulTable record = new AwfulTable();
record.seteMail("fred@fred.com");
record.setEmailaddress("alsofred@fred.com");
record.setFirstFirstName("fred1");
record.setFrom("from field");
record.setId1(new Integer(1));
record.setId2(new Integer(2));
record.setId5(new Integer(5));
record.setId6(new Integer(6));
record.setId7(new Integer(7));
record.setSecondFirstName("fred2");
record.setThirdFirstName("fred3");
Integer generatedCustomerId = dao.insert(record);
AwfulTable newRecord = new AwfulTable();
newRecord.setCustomerId(generatedCustomerId);
newRecord.setId1(new Integer(11));
newRecord.setId2(new Integer(22));
int rows = dao.updateByPrimaryKeySelective(newRecord);
assertEquals(1, rows);
AwfulTableKey key = new AwfulTableKey();
key.setCustomerId(generatedCustomerId);
AwfulTable returnedRecord = dao.selectByPrimaryKey(key);
assertEquals(generatedCustomerId, returnedRecord.getCustomerId());
assertEquals(record.geteMail(), returnedRecord.geteMail());
assertEquals(record.getEmailaddress(), returnedRecord.getEmailaddress());
assertEquals(record.getFirstFirstName(), returnedRecord.getFirstFirstName());
assertEquals(record.getFrom(), returnedRecord.getFrom());
assertEquals(newRecord.getId1(), returnedRecord.getId1());
assertEquals(newRecord.getId2(), returnedRecord.getId2());
assertEquals(record.getId5(), returnedRecord.getId5());
assertEquals(record.getId6(), returnedRecord.getId6());
assertEquals(record.getId7(), returnedRecord.getId7());
assertEquals(record.getSecondFirstName(), returnedRecord.getSecondFirstName());
assertEquals(record.getThirdFirstName(), returnedRecord.getThirdFirstName());
} catch (SQLException e) {
fail(e.getMessage());
}
}
use of mbg.test.ib2j2.generated.conditional.dao.AwfulTableDAO in project generator by mybatis.
the class HierarchicalJava2Test method testAwfulTableDeleteByPrimaryKey.
public void testAwfulTableDeleteByPrimaryKey() {
AwfulTableDAO dao = getAwfulTableDAO();
try {
AwfulTable record = new AwfulTable();
record.seteMail("fred@fred.com");
record.setEmailaddress("alsofred@fred.com");
record.setFirstFirstName("fred1");
record.setFrom("from field");
record.setId1(new Integer(1));
record.setId2(new Integer(2));
record.setId5(new Integer(5));
record.setId6(new Integer(6));
record.setId7(new Integer(7));
record.setSecondFirstName("fred2");
record.setThirdFirstName("fred3");
Integer generatedCustomerId = dao.insert(record);
AwfulTableKey key = new AwfulTableKey();
key.setCustomerId(generatedCustomerId);
int rows = dao.deleteByPrimaryKey(key);
assertEquals(1, rows);
AwfulTableExample example = new AwfulTableExample();
List answer = dao.selectByExample(example);
assertEquals(0, answer.size());
} catch (SQLException e) {
fail(e.getMessage());
}
}
Aggregations