Ebean如何将String排除为列

时间:2012-06-28 00:59:53

标签: playframework playframework-2.0 ebean

所以我有以下代码。我正在尝试创建一个名为SecurityType的表,其中包含值ID和描述。我想在其中添加两个字符串“Administrator”和“user”。有没有办法可以将这两个排除在ebean表中的列之外?还是我需要搬到另一个班级?

@Entity
public class SecurityType extends Model {
    public static final String ADMIN = "Administrator";
    public static final String USER = "User";
    @Id
    public Long id;

    public String description;
}

1 个答案:

答案 0 :(得分:19)

让它们变得短暂:

@Entity
public class SecurityType extends Model {
    @Transient
    public static final transient String ADMIN = "Administrator";
    @Transient
    public static final transient String USER = "User";
    @Id
    public Long id;

    public String description;
}