2010-12-09 3 views

답변

2

그래, 아마도 당신이 예상했던대로.

제한

  1. time out if it takes more then 30 seconds, 태스크로 실행하지 않는 한이 time out if it takes more then 10 minutes 것이다 경우이다.
  2. can't query on a property that doesn't exist 이후 업데이트해야하는 항목을 가져 오는 더 스마트 한 방법은 없습니다.

해결

  1. 당신은 구현을 얻을 에 appengine-mapreduce project 보길 원하는 것 그 이상 다음 십분 벽 시계 시간 수 완료.
  2. 아무도 알려져 있지 않습니다.

코드

void updateNullBarField() { 
    final Text DEFAULT_BAR = new Text("bar"); 

    PersistenceManagerFactory pmfInstance = JDOHelper 
    .getPersistenceManagerFactory("transactions-optional"); 
    PersistenceManager pm = pmfInstance.getPersistenceManager(); 
    Query query = pm.newQuery(Foo.class); 
    @SuppressWarnings("unchecked") 
    Collection<Foo> foos = pm.detachCopyAll((List<Foo>) query.execute()); 

    for (Foo foo : foos) { 
    if (foo.bar == null) { 
     foo.bar = DEFAULT_BAR; 
     pm.detachCopy(pm.makePersistent(foo)); 
    } 
    } 
} 
관련 문제