I have a situation - in my EquipmentType class I have a list of equipment checkouts
List<Key<EquipmentCheckout>> field
after reading the answer to this question: Objectify Relationships: One-to-Many, Can I do this efficiently? - it seems as the more efficient way to do this is to create a class called EquipmentCheckouts which would look something like the following:
class EquipmentCheckouts
@Id
Long id
@Parent
EquipmentType equipmentType
@Indexed
List<EquipmentCheckout> equipmentCheckouts
now - here's what I'm wondering - I'm using RequestFactory and I believe the RequestFactory has to have a find(Long id) method. From what I understand in order to retrieve an EquipmentCheckouts object with an EquipmentType parent you would have to do something along the lines of the following:
Key<EquipmentType> key = ObjectifyService.factory().getKey(equipmentType)
return ofy.get(new Key<EquipmentCheckouts>(key, EquipmentCheckouts.class, id))
So, if you couldn't have the EquipmentType in the find(Long id) method how are you supposed to do this?
For everything else in my system I have a Business parent which is stored in the logged in users session, that way when I go to retrieve everything I authenticate the user then key the business to find whatever it is. I feel as if there's something i'm not understanding about using @Parent in Objectify correctly.