Search in sources :

Example 1 with TextedUser

use of activerecordtext.TextedUser in project jSqlBox by drinkjava2.

the class UsuageAndSpeedTest method sqlMapperUseText.

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

Aggregations

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