use of mbg.test.ib2j2.generated.hierarchical.model.AwfulTableKey in project generator by mybatis.
the class HierarchicalJava2Test method testAwfulTableInsert.
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(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);
assertEquals(57, generatedCustomerId.intValue());
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(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.hierarchical.model.AwfulTableKey in project generator by mybatis.
the class HierarchicalJava2Test method testAwfulTableInsertSelective.
public void testAwfulTableInsertSelective() {
AwfulTableDAO dao = getAwfulTableDAO();
try {
AwfulTable record = new AwfulTable();
record.seteMail("fred@fred.com");
record.setEmailaddress("alsofred@fred.com");
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.insertSelective(record);
assertEquals(57, generatedCustomerId.intValue());
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("Mabel", 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.hierarchical.model.AwfulTableKey in project generator by mybatis.
the class HierarchicalJava5Test method testAwfulTableDeleteByPrimaryKey.
@Test
public void testAwfulTableDeleteByPrimaryKey() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
AwfulTableMapper mapper = sqlSession.getMapper(AwfulTableMapper.class);
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");
mapper.insert(record);
Integer generatedCustomerId = record.getCustomerId();
AwfulTableKey key = new AwfulTableKey();
key.setCustomerId(generatedCustomerId);
int rows = mapper.deleteByPrimaryKey(key);
assertEquals(1, rows);
AwfulTableExample example = new AwfulTableExample();
List<AwfulTable> answer = mapper.selectByExample(example);
assertEquals(0, answer.size());
} finally {
sqlSession.close();
}
}
use of mbg.test.ib2j2.generated.hierarchical.model.AwfulTableKey in project generator by mybatis.
the class HierarchicalJava5Test 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());
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(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 (Exception e) {
fail(e.getMessage());
}
}
use of mbg.test.ib2j2.generated.hierarchical.model.AwfulTableKey in project generator by mybatis.
the class HierarchicalJava5Test method testAwfulTableUpdateByPrimaryKey.
@Test
public void testAwfulTableUpdateByPrimaryKey() {
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);
record.setId1(11);
record.setId2(22);
int rows = dao.updateByPrimaryKey(record);
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(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 (Exception e) {
fail(e.getMessage());
}
}
Aggregations