调用代码:
final UUID uuid = UUID.randomUUID();
TableName.run(uuid.toString(), new Runnable() {
public void run() {
dao2.create(Term.class, true);
List<Term> termList = termService.query(null, null);
for (Term term : termList) {
dao2.insert(term, FieldFilter.create(Term.class, FieldMatcher.create(false)));
}
String tableName = Daos.getTableName(dao2, Term.class, uuid.toString());
dao2.drop("t_term");
dao2.execute(Sqls.create("rename table " + tableName + " to t_term;"));
}
});
Term的注解:
@Table("t_term${guid}")