use of mbg.test.mb3.generated.conditional.model.Pkfieldsblobs in project generator by mybatis.
the class ConditionalJava5Test method testPKFieldsBlobsSelectByExampleWithoutBlobs.
@Test
public void testPKFieldsBlobsSelectByExampleWithoutBlobs() {
PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
try {
Pkfieldsblobs record = new Pkfieldsblobs();
record.setId1(3);
record.setId2(4);
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(generateRandomBlob());
dao.insert(record);
record = new Pkfieldsblobs();
record.setId1(5);
record.setId2(6);
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(generateRandomBlob());
dao.insert(record);
PkfieldsblobsExample example = new PkfieldsblobsExample();
example.createCriteria().andId2EqualTo(6);
List<Pkfieldsblobs> answer = dao.selectByExampleWithoutBLOBs(example);
assertEquals(1, answer.size());
Pkfieldsblobs newRecord = answer.get(0);
assertEquals(record.getId1(), newRecord.getId1());
assertEquals(record.getId2(), newRecord.getId2());
assertEquals(record.getFirstname(), newRecord.getFirstname());
assertEquals(record.getLastname(), newRecord.getLastname());
assertNull(newRecord.getBlob1());
} catch (SQLException e) {
fail(e.getMessage());
}
}
use of mbg.test.mb3.generated.conditional.model.Pkfieldsblobs in project generator by mybatis.
the class ConditionalJava5Test method testPKFieldsBlobsSelectByExampleWithBlobs.
@Test
public void testPKFieldsBlobsSelectByExampleWithBlobs() {
PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
try {
Pkfieldsblobs record = new Pkfieldsblobs();
record.setId1(3);
record.setId2(4);
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(generateRandomBlob());
dao.insert(record);
record = new Pkfieldsblobs();
record.setId1(5);
record.setId2(6);
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(generateRandomBlob());
dao.insert(record);
PkfieldsblobsExample example = new PkfieldsblobsExample();
example.createCriteria().andId2EqualTo(6);
List<Pkfieldsblobs> answer = dao.selectByExampleWithBLOBs(example);
assertEquals(1, answer.size());
Pkfieldsblobs newRecord = answer.get(0);
assertEquals(record.getId1(), newRecord.getId1());
assertEquals(record.getId2(), newRecord.getId2());
assertEquals(record.getFirstname(), newRecord.getFirstname());
assertEquals(record.getLastname(), newRecord.getLastname());
assertTrue(blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
} catch (SQLException e) {
fail(e.getMessage());
}
}
use of mbg.test.mb3.generated.conditional.model.Pkfieldsblobs in project generator by mybatis.
the class ConditionalJava5Test method testPKFieldsBlobsSelectByPrimaryKey.
@Test
public void testPKFieldsBlobsSelectByPrimaryKey() {
PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
try {
Pkfieldsblobs record = new Pkfieldsblobs();
record.setId1(3);
record.setId2(4);
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(generateRandomBlob());
dao.insert(record);
record = new Pkfieldsblobs();
record.setId1(5);
record.setId2(6);
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(generateRandomBlob());
dao.insert(record);
PkfieldsblobsExample example = new PkfieldsblobsExample();
List<Pkfieldsblobs> answer = dao.selectByExampleWithoutBLOBs(example);
assertEquals(2, answer.size());
PkfieldsblobsKey key = new PkfieldsblobsKey();
key.setId1(5);
key.setId2(6);
Pkfieldsblobs newRecord = dao.selectByPrimaryKey(key);
assertEquals(record.getId1(), newRecord.getId1());
assertEquals(record.getId2(), newRecord.getId2());
assertEquals(record.getFirstname(), newRecord.getFirstname());
assertEquals(record.getLastname(), newRecord.getLastname());
assertTrue(blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
} catch (SQLException e) {
fail(e.getMessage());
}
}
use of mbg.test.mb3.generated.conditional.model.Pkfieldsblobs in project generator by mybatis.
the class ConditionalJava5Test method testPKFieldsBlobsDeleteByExample.
@Test
public void testPKFieldsBlobsDeleteByExample() {
PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
try {
Pkfieldsblobs record = new Pkfieldsblobs();
record.setId1(3);
record.setId2(4);
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(generateRandomBlob());
dao.insert(record);
record = new Pkfieldsblobs();
record.setId1(5);
record.setId2(6);
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(generateRandomBlob());
dao.insert(record);
PkfieldsblobsExample example = new PkfieldsblobsExample();
List<Pkfieldsblobs> answer = dao.selectByExampleWithoutBLOBs(example);
assertEquals(2, answer.size());
example = new PkfieldsblobsExample();
example.createCriteria().andId1NotEqualTo(3);
int rows = dao.deleteByExample(example);
assertEquals(1, rows);
example = new PkfieldsblobsExample();
answer = dao.selectByExampleWithoutBLOBs(example);
assertEquals(1, answer.size());
} catch (SQLException e) {
fail(e.getMessage());
}
}
use of mbg.test.mb3.generated.conditional.model.Pkfieldsblobs in project generator by mybatis.
the class UpdateByExampleTest method testPKFieldsBlobsUpdateByExampleSelective.
@Test
public void testPKFieldsBlobsUpdateByExampleSelective() {
PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
try {
Pkfieldsblobs record = new Pkfieldsblobs();
record.setId1(3);
record.setId2(4);
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(generateRandomBlob());
dao.insert(record);
record = new Pkfieldsblobs();
record.setId1(5);
record.setId2(6);
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(generateRandomBlob());
dao.insert(record);
Pkfieldsblobs newRecord = new Pkfieldsblobs();
newRecord.setFirstname("Fred");
PkfieldsblobsExample example = new PkfieldsblobsExample();
example.createCriteria().andId1NotEqualTo(3);
int rows = dao.updateByExampleSelective(newRecord, example);
assertEquals(1, rows);
List<Pkfieldsblobs> answer = dao.selectByExampleWithBLOBs(example);
assertEquals(1, answer.size());
Pkfieldsblobs returnedRecord = answer.get(0);
assertEquals(record.getId1(), returnedRecord.getId1());
assertEquals(record.getId2(), returnedRecord.getId2());
assertEquals(newRecord.getFirstname(), returnedRecord.getFirstname());
assertEquals(record.getLastname(), returnedRecord.getLastname());
assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
} catch (SQLException e) {
fail(e.getMessage());
}
}
Aggregations