2

是否有可能在 ormlite 中进行这样的构造,如果是,我该如何查询以获得第三个集合

@DatabaseTable(tableName = "persons")
public class Person {

    @DatabaseField(generatedId = true)
    private int id;

    @DatabaseField(canBeNull = true)
    private String name;

    @ForeignCollectionField
    private ForeignCollection<App> apps;
}

@DatabaseTable(tableName = "apps")
public class App {

    @DatabaseField(generatedId = true)
    private int id;

    @DatabaseField(canBeNull = true)
    private String name;

    @DatabaseField(foreign = true, foreignAutoRefresh = true, columnName = "person_id")
    private Person person;

    @ForeignCollectionField
    private ForeignCollection<New> news;
}

@DatabaseTable(tableName = "news")
public class New {

    @DatabaseField(generatedId = true)
    private int id;

    @DatabaseField(canBeNull = true)
    private String name;

    public App getApp() {
        return app;
    }

    public void setApp(App app) {
        this.app = app;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @DatabaseField(foreign = true, foreignAutoRefresh = true, columnName = "app_id")

    private App app;
}

tnx 提前

4

0 回答 0