Search in sources :

Example 11 with Record

use of org.nutz.dao.entity.Record in project nutz by nutzam.

the class RecordDaoTest method test_insert_with_autoinc_id.

@Test
public void test_insert_with_autoinc_id() {
    if (dao.meta().isOracle())
        return;
    Dao dao = ioc.get(Dao.class);
    for (int i = 0; i < 10; i++) {
        Record re = Record.create();
        re.put("*name", "wendal" + R.UU32());
        re.put("+id", 0);
        re.put(".table", "t_pet");
        dao.insert(re);
        assertTrue(re.getInt("id") > 0);
    }
}
Also used : Dao(org.nutz.dao.Dao) Record(org.nutz.dao.entity.Record) Test(org.junit.Test)

Aggregations

Record (org.nutz.dao.entity.Record)11 Test (org.junit.Test)10 Pet (org.nutz.dao.test.meta.Pet)5 Sql (org.nutz.dao.sql.Sql)4 Dao (org.nutz.dao.Dao)3 HashMap (java.util.HashMap)2 CallableStatement (java.sql.CallableStatement)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 Timestamp (java.sql.Timestamp)1 TreeMap (java.util.TreeMap)1 ValueAdaptor (org.nutz.dao.jdbc.ValueAdaptor)1 VarIndex (org.nutz.dao.sql.VarIndex)1 VarSet (org.nutz.dao.sql.VarSet)1 Issue1163Pet (org.nutz.dao.test.meta.issue1163.Issue1163Pet)1 SystemTeam (org.nutz.dao.util.meta.SystemTeam)1 SystemUser (org.nutz.dao.util.meta.SystemUser)1 NutType (org.nutz.lang.util.NutType)1