我正在尝试使用 GreenDAO 在我的数据库中创建实体。我的对象是由这个类定义的:
public class Container {
String id; //GUID
String name;
Product product;
}
public class Product {
String urlImage;
String productName;
String description;
}
以下代码正在定义我的实体:
Entity container = schema.addEntity("Container");
Property productsForeignKey = container.addStringProperty("id").notNull().unique().getProperty();
container.addStringProperty("name");
Entity product = schema.addEntity("Product");
product.addStringProperty("productName");
product.addStringProperty("urlImage");
product.addStringProperty("description");
containerToProduct = container.addToOne(product, productsForeignKey);
最后我得到了这个例外:
java.lang.RuntimeException: Currently only single FK columns are supported: ToOne 'product' from Container to Product
我做错了什么?