use of mbg.test.ib2j2.generated.conditional.model.Pkfieldsblobs in project generator by mybatis.
the class SelectByPrimaryKeyTest method testPKFieldsBlobsSelectByPrimaryKey.
public void testPKFieldsBlobsSelectByPrimaryKey() {
PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
try {
Pkfieldsblobs record = new Pkfieldsblobs();
record.setId1(new Integer(3));
record.setId2(new Integer(4));
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(TestUtilities.generateRandomBlob());
dao.insert(record);
record = new Pkfieldsblobs();
record.setId1(new Integer(5));
record.setId2(new Integer(6));
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(TestUtilities.generateRandomBlob());
dao.insert(record);
PkfieldsblobsExample example = new PkfieldsblobsExample();
List answer = dao.selectByExampleWithoutBLOBs(example);
assertEquals(2, answer.size());
PkfieldsblobsKey key = new PkfieldsblobsKey();
key.setId1(new Integer(5));
key.setId2(new Integer(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(TestUtilities.blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
} catch (Exception e) {
fail(e.getMessage());
}
}
use of mbg.test.ib2j2.generated.conditional.model.Pkfieldsblobs in project generator by mybatis.
the class DeleteByExampleTest method testPKFieldsBlobsDeleteByExample.
public void testPKFieldsBlobsDeleteByExample() {
PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
try {
Pkfieldsblobs record = new Pkfieldsblobs();
record.setId1(new Integer(3));
record.setId2(new Integer(4));
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(TestUtilities.generateRandomBlob());
dao.insert(record);
record = new Pkfieldsblobs();
record.setId1(new Integer(5));
record.setId2(new Integer(6));
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(TestUtilities.generateRandomBlob());
dao.insert(record);
PkfieldsblobsExample example = new PkfieldsblobsExample();
List answer = dao.selectByExampleWithoutBLOBs(example);
assertEquals(2, answer.size());
example = new PkfieldsblobsExample();
example.createCriteria().andId1NotEqualTo(new Integer(3));
int rows = dao.deleteByExample(example);
assertEquals(1, rows);
example = new PkfieldsblobsExample();
answer = dao.selectByExampleWithoutBLOBs(example);
assertEquals(1, answer.size());
} catch (Exception e) {
fail(e.getMessage());
}
}
use of mbg.test.ib2j2.generated.conditional.model.Pkfieldsblobs in project generator by mybatis.
the class DeleteByPrimaryKeyTest method testPKFieldsBlobsDeleteByPrimaryKey.
public void testPKFieldsBlobsDeleteByPrimaryKey() {
PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
try {
Pkfieldsblobs record = new Pkfieldsblobs();
record.setId1(new Integer(3));
record.setId2(new Integer(4));
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(TestUtilities.generateRandomBlob());
dao.insert(record);
record = new Pkfieldsblobs();
record.setId1(new Integer(5));
record.setId2(new Integer(6));
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(TestUtilities.generateRandomBlob());
dao.insert(record);
PkfieldsblobsExample example = new PkfieldsblobsExample();
List answer = dao.selectByExampleWithoutBLOBs(example);
assertEquals(2, answer.size());
PkfieldsblobsKey key = new PkfieldsblobsKey();
key.setId1(new Integer(5));
key.setId2(new Integer(6));
int rows = dao.deleteByPrimaryKey(key);
assertEquals(1, rows);
example = new PkfieldsblobsExample();
answer = dao.selectByExampleWithoutBLOBs(example);
assertEquals(1, answer.size());
} catch (Exception e) {
fail(e.getMessage());
}
}
use of mbg.test.ib2j2.generated.conditional.model.Pkfieldsblobs in project generator by mybatis.
the class CountByExampleTest method testPKFieldsBlobsCountByExample.
public void testPKFieldsBlobsCountByExample() {
PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
try {
Pkfieldsblobs record = new Pkfieldsblobs();
record.setId1(new Integer(3));
record.setId2(new Integer(4));
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(TestUtilities.generateRandomBlob());
dao.insert(record);
record = new Pkfieldsblobs();
record.setId1(new Integer(5));
record.setId2(new Integer(6));
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(TestUtilities.generateRandomBlob());
dao.insert(record);
PkfieldsblobsExample example = new PkfieldsblobsExample();
example.createCriteria().andId1NotEqualTo(new Integer(3));
long rows = dao.countByExample(example);
assertEquals(1, rows);
example.clear();
rows = dao.countByExample(example);
assertEquals(2, rows);
} catch (Exception e) {
fail(e.getMessage());
}
}
use of mbg.test.ib2j2.generated.conditional.model.Pkfieldsblobs in project generator by mybatis.
the class SelectByExampleTest method testPKFieldsBlobsSelectByExampleWithBlobs.
public void testPKFieldsBlobsSelectByExampleWithBlobs() {
PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
try {
Pkfieldsblobs record = new Pkfieldsblobs();
record.setId1(new Integer(3));
record.setId2(new Integer(4));
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(TestUtilities.generateRandomBlob());
dao.insert(record);
record = new Pkfieldsblobs();
record.setId1(new Integer(5));
record.setId2(new Integer(6));
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(TestUtilities.generateRandomBlob());
dao.insert(record);
PkfieldsblobsExample example = new PkfieldsblobsExample();
example.createCriteria().andId2EqualTo(new Integer(6));
List answer = dao.selectByExampleWithBLOBs(example);
assertEquals(1, answer.size());
Pkfieldsblobs newRecord = (Pkfieldsblobs) answer.get(0);
assertEquals(record.getId1(), newRecord.getId1());
assertEquals(record.getId2(), newRecord.getId2());
assertEquals(record.getFirstname(), newRecord.getFirstname());
assertEquals(record.getLastname(), newRecord.getLastname());
assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
} catch (Exception e) {
fail(e.getMessage());
}
}
Aggregations