I'm currently into evaluating GreenDAO for my application. I'm facing the following problem.
My app consists of several modules (seperated in packages, e.g. "com.example.app.results
", "com.example.app.synchronization
"). Some of them have no dependencies, some of them have dependencies on other modules (e.g. synchronization
has a dependency on results
, whereas results
has no dependency).
What I would like to model is the following:
Module results
has Entity MyResult
(attributes: name, value).
Module synchronization
has Entity MyResultSynchronization
(attributes: MyResult (reference), date).
final Schema schema = new Schema(1, "com.example.app");
final Entity myresult = schema.addEntity("results.MyResult");
final Property myresultId = myresult.addIdProperty().getProperty();
myresult.addStringProperty("name");
myresult.addStringProperty("value");
final Entity myResultSynchronization = schema.addEntity("synchronization.MyResultSynchronization");
myResultSynchronization.addIdProperty();
myResultSynchronization.addDateProperty("date");
myResultSynchronization.addToOne(myresult, myresultId);
but - $entityPackage.$name
does not what I expected it to do (neither did $package\$name
;-)).
My question is: Am I forced to have all entities of my app in a single package? Is what I'm trying to do feasible by creating multiple Schemas
- but than again, is it possible to use the relate-feature between two (or more) schemas? What is the "right" way to do it? (Is there one?)