SqlSession sqlSession = sqlSessionFactory.openSession();
try {
AwfulTableMapper mapper = sqlSession.getMapper(AwfulTableMapper.class);
AwfulTable record = new AwfulTable();
record.setFirstFirstName("Fred");
int rows = mapper.insert(record);
assertEquals(1, rows);
assertNotNull(record.getCustomerId());
record = new AwfulTable();
record.setFirstFirstName("Barney");
rows = mapper.insert(record);
assertEquals(1, rows);
assertNotNull(record.getCustomerId());
List<AwfulTable> records = mapper.selectAll();
assertEquals(2, records.size());
AwfulTable returnedRecord = mapper.selectByPrimaryKey(record.getCustomerId());
assertNotNull(returnedRecord);
assertEquals(record.getFirstFirstName(), returnedRecord.getFirstFirstName());
record.setFirstFirstName("Betty");
rows = mapper.updateByPrimaryKey(record);
assertEquals(1, rows);
returnedRecord = mapper.selectByPrimaryKey(record.getCustomerId());
assertNotNull(returnedRecord);
assertEquals(record.getFirstFirstName(), returnedRecord.getFirstFirstName());
rows = mapper.deleteByPrimaryKey(record.getCustomerId());
assertEquals(1, rows);
records = mapper.selectAll();