I have the following table:
@DatabaseTable
public class Jobs {
@DatabaseField(foreign = true, foreignAutoRefresh = true)
private Client client;
@DatabaseField(foreign = true, foreignAutoRefresh = true)
private Client billingClient;
....
}
And I wish to run the following query:
SELECT `jobs`.* FROM `jobs`
LEFT JOIN `clients` ON (`jobs`.`billing_client` = `clients`.`id` OR `jobs`.`client` = `clients`.`id`)
WHERE ...
When I try to build the above query using ORMLite's leftJoin method:
final Dao<Job, Long> repoJobs = MyApplication.db.getJobsRepository();
final Dao<Client, Long> repoClients = MyApplication.db.getClientsRepository();
builderJobs.leftJoin(builderClients);
I get this generated query instead:
SELECT `jobs`.* FROM `jobs`
LEFT JOIN `clients` ON `jobs`.`billing_client` = `clients`.`id`
WHERE ...
ORMLite ignores the other client of my table (even though I've marked it as "foreign = true" too).
How can I leftJoin on two columns using ORMLite?
Aucun commentaire:
Enregistrer un commentaire