I have a toMany relation in my schema ("A human has 1..N cats"). If I query a entity for its toMany-target entities I use the following code:
List<Cat> cats = human.getCatList();
Is the returned list guaranteed to be ordered? If yes, dependant on which property?
Additional Information (Generation Code):
In my schema (generator) the entities are created as follows:
Entity human = schema.addEntity("human");
human.addIdProperty().autoincrement();
Entity cat = schema.addEntity("cat");
cat.addIdProperty().autoincrement();
pb = cat.addLongProperty("humanId");
pb.notNull();
pb.indexAsc(null, false);
human.addToMany(cat, pb.getProperty());
I therefore thought the order is (implicitly) defined by the created index, but a look at CatDao.java
showed the index is created without a defined order:
"CREATE INDEX " + constraint + "IDX_CAT_HUMAN_ID ON CAT (HUMAN_ID);"
Changing the pb.indexAsc
to pb.indexDesc
does change the index name, but not the index order of the column (see: SQLite Syntax: indexed-column).
So - is this wanted behavior? How can I define the order of target entities?