I have a User
and Transaction
class
Each Transaction
logically belongs to a User
. But I may need to query for some subset of Transactions (ex: return all Transactions for User A with Transaction.type=1
)
In SQL I just maintain a Transaction.userID
field that links it with the User
table.
- In JDO's world of objects should I do the same? Store Transaction objects separate with a pointer-field to the
User
object ID? Or should I just query for the appropriate User object and sub-query for transactions with type=1 (for example)? - If I query just for the
User
object can I also return just thoseTransaction
objects that are of interest for the given query (as in the previous bullets example)?