Google App Engine / JDO: store calculated values

Since I cannot make JOIN queries to the App Engine datastore, I would like to restrict my object objects a bit to include computed values, effectively creating something like a functional index.

 @Persistent
 Employee manager;

 @Persistent
 // de-normalized stored join value
 Integer managerDepartmentCode;

      

This works great, but I need to manually make sure that I update the computed values ​​before continuing with the object. Is there a better way to do this?

For example, is it possible to annotate getters to be used to get computed values ​​with @Persistent instead of fields (there would be no corresponding setter or field)?

@Persistent
Employee manager;

@Persistent
// de-normalized stored join value, calculated on the fly
Integer getManagerDepartmentCode(){
   return manager.getDepartmentCode();
}

      

+2


source to share


1 answer


Could you put the logic in StoreCallback.jdoPreStore () or StoreLifecycleListener.preStore ?



+1


source







All Articles