Skip to content

Instantly share code, notes, and snippets.

@wendal
Created September 3, 2012 12:18
Show Gist options
  • Save wendal/3608917 to your computer and use it in GitHub Desktop.
Save wendal/3608917 to your computer and use it in GitHub Desktop.
Nutz Chain插入后获取主键
Trans.exec(new Atom() {
public void run() {
dao.insert("tp_pet", Chain.make("age", 12));
Sql sql = Sqls.fetchLong("SELECT @@@@IDENTITY");
dao.execute(sql);
long petId = sql.getObject(Long.class);
System.out.println(petId);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment