2012-09-05 7 views
0

데이터 저장소 인덱스에 키를 추가하는 데 몇 가지 제한이 있습니까?Google App Engine Java - 색인 및 키

나는 Test.java

@EntityBean(entityGroup="TestRoot", entityGroupKeyName="TestList") 
public class Test implements Serializable, JSONConvertible { 
    @Property(key=true,indexable=true) 
    private String keyName; 
    @Property(indexable=true) 
    private String userCode; 
    @Property(indexable=true) 
    private String name; 
... 

이 그리고 내 데이터 저장소-indexes.xml에서 : 내 테스트 목록을 주문하면

<datastore-index kind="Flight" ancestor="true"> 
    <property name="keyName" direction="desc"/> 
</datastore-index> 

<datastore-index kind="Flight" ancestor="true" source="manual"> 
    <property name="keyName" direction="asc"/> 
</datastore-index> 

<datastore-index kind="Flight" ancestor="true"> 
    <property name="userCode" direction="desc"/> 
</datastore-index> 

<datastore-index kind="Flight" ancestor="true" source="manual"> 
    <property name="userCode" direction="asc"/> 
</datastore-index> 

<datastore-index kind="Flight" ancestor="true"> 
    <property name="name" direction="desc"/> 
</datastore-index> 

<datastore-index kind="Flight" ancestor="true" source="manual"> 
    <property name="name" direction="asc"/> 
</datastore-index> 

나는 상태

봉사 내 모든 인덱스가 "userCode"와 "name"으로 잘 작동하지만 "keyName"을 사용하면 도움이되지 않습니까?

+0

Datastore에서 @EntityBean을 어떻게 사용하고 있습니까? –

답변

1

Key Filters을 읽어야합니다. 기본적으로 GAE에는 이미 키에 대한 오름차순 색인이 있으므로이를 작성할 필요가 없습니다. 키의 내림차순 인덱스의 경우 다음을 시도하십시오.

<datastore-index kind="Flight" ancestor="true"> 
    <property name="__key__" direction="desc"/> 
</datastore-index> 
+0

피터 고맙습니다! 그것은 작동합니다! – Marta