实体定义

jmms支持通过java class来定义实体。

下面以User实体具体说明如何进行定义:

  • 创建实体类User.java
import leap.lang.enums.Bool;
import leap.orm.annotation.Column;
import leap.orm.annotation.Id;
import leap.orm.annotation.Table;

@Table("user")
public class User {

    @Id
    protected String id;

    @Column(length = 200, nullable = Bool.TRUE)
    protected String firstName;

    @Column(length = 200, nullable = Bool.TRUE)
    protected String lastName;

    ...
}
  • 创建app/entities/User.json
{
    "className": "com.example.project.User"
}
Bingosoft            updated 2018-07-23
上一篇:开发API操作 下一篇:定义表名

results matching ""

    No results matching ""