Skip to content

PrimeKeys

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

Prime Key definition

Put a @PKey or @Id on entity class's filed, or use Java Method configuration's pkey() and id() method:

  @Table(table="user_tb")
  public class User{
    @Column(name="user_id")
    @Id
    private Integer userId;
    ...
  }
or
  TableModel t1 = new TableModel("user_tb");
  t1.column("user_id").INTEGER().pkey().entityField("userId");

If there are multiple columns be defined as prime keys, these keys will created as compound prime keys in DDL.

To modify a column's definition can use tableModel.getColumn("columnNameXXX") to get a ColumnModel instance and use Java method to change it. Similar, constraints, foreign keys, indexes all can be modified, created or deleted at run-time.

There are 10 Prime-Key generators supported is jDialects: 10 Prime Keys