我想将转换映射到此类并使用“ ActiveAndroid ”写入数据库。我不知道应该放什么样的注释? organizationId 应该是唯一的。我应该为select查询编写一些方法吗?。
public class Organization extends Model {
private String organizationId;
private List<Doctor> doctors;
private String organizationName;
private String photoUrl;
private Address address;
private Set<String> phoneNumber;
private String faxNumber;
private String key;
private int numberOfDoctors;
}
答案 0 :(得分:0)
对于简单列使用@Column注释,例如:
@Column(name="org_name")
private String organizationName;
并且使用唯一约束
@Column(name="org_id" , unique = true , onUniqueConflict = Column.ConflictAction.IGNORE)
private String organizationId;
并且不要忘记为类
放置表注释@Table(name = "organization")
public class Organization extends Model {