Search in sources :

Example 1 with AbstractUser

use of activerecordtext.AbstractUser in project jSqlBox by drinkjava2.

the class UsuageAndSpeedTest method abstractSqlMapperUseText.

@Test
public void abstractSqlMapperUseText() {
    SqlBoxContext ctx = new SqlBoxContext(dataSource);
    // use global default context
    SqlBoxContext.setGlobalSqlBoxContext(ctx);
    AbstractUser user = ActiveRecord.create(AbstractUser.class);
    for (int i = 0; i < REPEAT_TIMES; i++) {
        user.insertOneUser("Sam", "Canada");
        user.ctx().nUpdate(user.updateUserPreparedSQL("Tom", "China"));
        // List<Map<String, Object>> users = user.selectUserListMap("Tom", "China");
        // Assert.assertEquals(1, users.size());
        List<AbstractUser> users2 = user.selectAbstractUserList("Tom", "China");
        Assert.assertEquals(1, users2.size());
        user.deleteUsers("Tom", "China");
        Assert.assertEquals(0, user.ctx().nQueryForLongValue("select count(*) from	 users"));
    }
}
Also used : AbstractUser(activerecordtext.AbstractUser) SqlBoxContext(com.github.drinkjava2.jsqlbox.SqlBoxContext) Test(org.junit.Test)

Aggregations

AbstractUser (activerecordtext.AbstractUser)1 SqlBoxContext (com.github.drinkjava2.jsqlbox.SqlBoxContext)1 Test (org.junit.Test)1