Skip to content

CustomizedGenerator

Yong Zhu edited this page Jan 20, 2018 · 1 revision

To build a customized prime key generator just follow below steps:

  1. Write a class impliemnts IdGenerator interface:
public class myIdGen implements IdGenerator { 
  //...
}
  1. Use it in Java method configuration:
tableModel.addGenerator(new myIdGen ("myId"));
tableModel.column("id").STRING(30).pkey().idGenerator("myId");

3.Use a ORM tool which implemented NormalJdbcTool interface like jSqlBox, call dialect.getNexID(col.getIdGenerator(), jdbcTool, col.getColumnType()) method, the will get the generated value.

For more detail can see source code of SortedUUID.

Clone this wiki locally