Object faulting - njkremer/SqliteORM GitHub Wiki

With object faulting you can operate on a relationship as if the object actually has those objects.

This might be more obviously conveyed in code:

Give the user:

public class User {
 
   @PrimaryKey
   private int id;

   @OneToMany("userId")
   private List<Thing> things;
 }

You can then, through object faulting, assume that a user will have a List of things, and can operate that way without doing a explicitly selecting from a user as outlined in the Relationships section:

User nick = SqlStatement.select(User.class).where("name").eq("Nick").getFirst();
List<Thing> nicksThings = nick.getThings();

This will automatically query the database for all of the Thing objects that belong to the User Nick.

Please note that this will only work on non-Android environments since it leverages bytecode generation which is not supported on Android. Android support is planned for the future leveraging Dexmaker

⚠️ **GitHub.com Fallback** ⚠️