Search in sources :

Example 26 with Pet

use of test.po.Pet in project eweb4j-framework by laiweiwei.

the class CRUDTest method testUpdate.

public void testUpdate() throws Exception {
    Pet pet = new Pet();
    pet.setPetId(2);
    pet.setAge(12);
    pet.setName("i'm laiweiwei too");
    Models.inst(pet).save("age", "name");
    Assert.assertEquals(2, pet.getPetId());
    Assert.assertEquals(12, pet.getAge());
    Assert.assertEquals("i'm laiweiwei too", pet.getName());
}
Also used : Pet(test.po.Pet)

Example 27 with Pet

use of test.po.Pet in project eweb4j-framework by laiweiwei.

the class CRUDTest method testSelect.

public void testSelect() throws Exception {
    Pet pet = DAOFactory.getDAO(Pet.class).selectAll().where().field("name").equal("i'm laiweiwei").queryOne();
    Assert.assertEquals(1, pet.getPetId());
    Assert.assertEquals(12, pet.getAge());
    Assert.assertEquals("i'm laiweiwei", pet.getName());
}
Also used : Pet(test.po.Pet)

Aggregations

Pet (test.po.Pet)27 Master (test.po.Master)8 BeforeClass (org.junit.BeforeClass)4 Test (org.junit.Test)4 HashMap (java.util.HashMap)3 DAOException (org.eweb4j.orm.dao.DAOException)3 Sql (org.eweb4j.orm.sql.Sql)3 DAO (org.eweb4j.orm.dao.DAO)2 Map (java.util.Map)1 EntityManager (javax.persistence.EntityManager)1 EntityManagerFactory (javax.persistence.EntityManagerFactory)1 Trans (org.eweb4j.orm.jdbc.transaction.Trans)1