I have two tables that share a one to many relationship. i.e. Table2 has an FK that references the PK from Table1, which is an auto-incrementing id value.
The normal record creation process would be:
- Create instance of Table1
- Create instance of Table2
- Create the relationship by setting the FK value in Table2 to Table1.getid()
However, I only want a local representation of the records in java, which I may or may not decide to save to the database later, depending on user input. However, I can't do this because I can't create the relationship between them, as the auto-incremented id is only created when the record is saved to the db (step 2).
That means that I can't use Table1.getTable2List(), because the relationship between them does not exist.
Is it even possible to use methods that rely on a relationship between tables, such as get...List(), on local java objects, before they are saved to the db?
If so, is there a way to do this when the FK is an auto-incrementing?
Otherwise, I like the ORM so far! I am new to both Android and Vertabelo and it seems to be saving me some time already so thanks :)
Customer support service by UserEcho