Skip to content

Instantly share code, notes, and snippets.

@wendal
Created August 30, 2012 04:08
Show Gist options
  • Save wendal/3522223 to your computer and use it in GitHub Desktop.
Save wendal/3522223 to your computer and use it in GitHub Desktop.
nutz 测试删除后再插入原本的记录
public class DaoTest {
@Test
public void test_insert_after_del() {
dao.create(Pet.class, true);
dao.insert(Pet.create("wendal"));
Trans.exec(new Atom() {
public void run() {
dao.execute(Sqls.create("delete from t_pet"));
dao.insert(Pet.create("wendal"));
}
});
}
}
@Table("t_pet")
public class Pet {
@Id
private long id;
@Name
private String name;
public static Pet create(String name) {
Pet pet = new Pet();
pet.name = name;
return pet;
}
//getter or setter
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment