@Entity(nameInDb = "ProjectInfo")
public class ProjectInfo {
@Id(autoincrement = true)
private Long id;
@NotNull
private String name;
private String absPath;
private Date time;
@ToMany(referencedJoinProperty = "projectId")
private List<Point> pointList;
@Entity
public class Point {
@Id
private Long id;
private long projectId;
private String name;
@ToOne(joinProperty = "projectId")
private ProjectInfo projectInfo;
// greendao generated code:↓
class PointDao{
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"POINT\" (" + //
"\"_id\" INTEGER PRIMARY KEY ," + // 0: id
"\"PROJECT_ID\" INTEGER NOT NULL ," + // 1: projectId
"\"NAME\" TEXT);"); // 2: name
}
}
Question: why create table not cotain foreign key constraint like this:
https://greenrobot.org/greendao/documentation/relations/
this code not working。my code is:
Question: why create table not cotain foreign key constraint like this: