Using ORMLite for Android, I need to create a query that returns orders by order ID or by customer name. Please consider the following class declarations:
@DatabaseTable(tableName = "order") public class Order { @DatabaseField(generatedId = true) private Long id; @DatabaseField(foreign = true, canBeNull = false, foreignAutoRefresh = true, columnName = "customer_id") private Customer customer;
The raw SQL I'm looking for would be something like this:
SELECT o.* FROM order o JOIN customer c on o.customer_id = c.id WHERE (o.id = ?) OR (c.name = ?)
What is the best way to do this with ORMLite?
itmartins
source share