Search in sources :

Example 61 with AwfulTableDAO

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());
    }
}
Also used : SQLException(java.sql.SQLException) AwfulTableDAO(mbg.test.ib2j5.generated.conditional.dao.AwfulTableDAO) AwfulTable(mbg.test.ib2j5.generated.conditional.model.AwfulTable) Test(org.junit.Test)

Example 62 with AwfulTableDAO

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());
    }
}
Also used : SQLException(java.sql.SQLException) AwfulTableDAO(mbg.test.ib2j5.generated.conditional.dao.AwfulTableDAO) AwfulTable(mbg.test.ib2j5.generated.conditional.model.AwfulTable) Test(org.junit.Test)

Example 63 with AwfulTableDAO

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());
    }
}
Also used : AwfulTableExample(mbg.test.ib2j5.generated.conditional.model.AwfulTableExample) SQLException(java.sql.SQLException) AwfulTableDAO(mbg.test.ib2j5.generated.conditional.dao.AwfulTableDAO) AwfulTable(mbg.test.ib2j5.generated.conditional.model.AwfulTable) Test(org.junit.Test)

Example 64 with AwfulTableDAO

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());
    }
}
Also used : SQLException(java.sql.SQLException) AwfulTableDAO(mbg.test.ib2j2.generated.hierarchical.dao.AwfulTableDAO) AwfulTable(mbg.test.ib2j2.generated.hierarchical.model.AwfulTable) AwfulTableKey(mbg.test.ib2j2.generated.hierarchical.model.AwfulTableKey)

Example 65 with AwfulTableDAO

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());
    }
}
Also used : AwfulTableExample(mbg.test.ib2j2.generated.hierarchical.model.AwfulTableExample) SQLException(java.sql.SQLException) AwfulTableDAO(mbg.test.ib2j2.generated.hierarchical.dao.AwfulTableDAO) AwfulTable(mbg.test.ib2j2.generated.hierarchical.model.AwfulTable) AwfulTableKey(mbg.test.ib2j2.generated.hierarchical.model.AwfulTableKey) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

SQLException (java.sql.SQLException)48 List (java.util.List)30 ArrayList (java.util.ArrayList)23 AwfulTableDAO (mbg.test.ib2j2.generated.conditional.dao.AwfulTableDAO)16 AwfulTable (mbg.test.ib2j2.generated.conditional.model.AwfulTable)16 AwfulTableDAO (mbg.test.ib2j2.generated.flat.dao.AwfulTableDAO)16 AwfulTable (mbg.test.ib2j2.generated.flat.model.AwfulTable)16 AwfulTableDAO (mbg.test.ib2j2.generated.hierarchical.dao.AwfulTableDAO)16 AwfulTable (mbg.test.ib2j2.generated.hierarchical.model.AwfulTable)16 AwfulTableDAO (mbg.test.ib2j5.generated.conditional.dao.AwfulTableDAO)16 AwfulTable (mbg.test.ib2j5.generated.conditional.model.AwfulTable)16 Test (org.junit.Test)16 AwfulTableExample (mbg.test.ib2j2.generated.conditional.model.AwfulTableExample)11 AwfulTableExample (mbg.test.ib2j2.generated.flat.model.AwfulTableExample)11 AwfulTableExample (mbg.test.ib2j2.generated.hierarchical.model.AwfulTableExample)11 AwfulTableExample (mbg.test.ib2j5.generated.conditional.model.AwfulTableExample)11 AwfulTableKey (mbg.test.ib2j2.generated.hierarchical.model.AwfulTableKey)6 AwfulTableDAOImpl (mbg.test.ib2j2.generated.flat.dao.AwfulTableDAOImpl)1