這裏的:-) 我們有兩個班,Appointment
和Hairdresser
,兩者具有相同,一個祖先(靜態最終鍵:topParent
)的東西代表HairSalon
關鍵。該Appointment
包含Hairdresser
這樣的:
物化谷歌DataSore查詢
@Parent
public Key parent;
public Key hairdresserKey;`
但是,當我們試圖篩選出的任命,不拿出一個結果。 hairdresserKey == null
中的父母可能是一個線索,但我們現在有點卡住了。
那麼有人可以告訴我們這個查詢有什麼問題嗎?
非常感謝!
appointment.hairdresserKey = new Key<Hairdresser>(topParent, Hairdresser.class, appointment.hairdresser.id);
appointment.parent = topParent;
Key<Hairdresser> queryKey = new Key<Hairdresser>(topParent, Hairdresser.class, appointment.hairdresser.id);
Objectify ofyTransaction = ObjectifyService.beginTransaction();
try {
List<Key<Appointment>> previousTimeSlotOneHour = ofyTransaction.query(Appointment.class)
.ancestor(topParent)
.filter("hairdresserKey", appointment.hairdresserKey)
.filter("timeSlot", appointment.timeSlot.getPreviousTimeSlot())
.filter("LENGTH", 1.0d).listKeys();
要clearify更多一些,這是約會如何設置:
@Unindexed
公共類任用實現Serializable {
@Id
public Long id;
@Indexed
public TimeSlot timeSlot;
@Transient
public WorkDay workDay;
@Transient
public Customer customer;
public Key customerKey;
public int END_TIME_HOUR;
public int END_TIME_MINUTES;
@Indexed
public TREATMENT treatment = TREATMENT.TREATMENT_CUT;
public int revisionNumber = -1;
/* QUERY Fields */
@Indexed
private String stringDate;
private double LENGTH;
@Parent
public Key parent;
private Date date;
@Transient
public Hairdresser hairdresser;
public Key hairdresserKey;
您是否爲{ancestor,hairdresserKey,timeSlot,LENGTH} *和*單個屬性索引創建了所有這些字段的多屬性索引? – stickfigure