이 블로그 검색

레이블이 JDOQL인 게시물을 표시합니다. 모든 게시물 표시
레이블이 JDOQL인 게시물을 표시합니다. 모든 게시물 표시

2012년 1월 24일 화요일

defaultFetchGroup = "true"

@Persistent(defaultFetchGroup = "true")

자식값도 기본으로 가져오게 하기 위한 설정

If you want to load the child, you can either "touch" it before closing the PersistenceManager (e.g. by calling getContactInfo() in the above example) or explicitly add the child field to the default fetch group so it's retrieved and loaded with the parent:

2011년 9월 9일 금요일

jdo 쿼리오류. org.datanucleus.store.appengine.query.StreamingQueryResult cannot be cast

org.datanucleus.store.appengine.query.StreamingQueryResult cannot be cast ~~

List<SajuDataTable> sajuInfo = (List<SajuDataTable>)query.execute(UserServiceWrapper.get().getCurrentUserId());

이런씩으로 List로 받아야한다.
SajuDataTable로 곧바로 캐스트가 않됨.
왜냐하면 여러행이 나올수 있기때문...

2011년 4월 2일 토요일

child


public Item load() {
    PersistenceManager pm = PersistenceManagerFactoryGetter.get().getPersistenceManager();
    List<Data> datas = new ArrayList<Data>();
    Data data0 = null;
    try {
        Query q = pm.newQuery(Data.class);
        datas = (List<Data>) q.execute();
        if (datas.size() > 0)
            data0 = pm.detachCopy(datas.get(0)); // get first item only

    } finally {
        pm.close();
    }
    return data0.item;  // always null !!!!!
}

Hi,
I encounter problems while trying to implement GWT JDO features. Let's say there is a Data object that contains an Item object. In the datastore this would create a one-to-one relationship.
The problem is that when I try to get the object from the datastore, the 'item' field is always null. Of course I put the object to the datastore that contains the initalized Item object (end of the listing). When viewing the datastore, both Data and Item entities do exist.
Do I manage the one-to-one relationship wrong? What else is needed? The same situation is when I try to create one-to-many relatioship (an array of Item's)
Thanks for any hints.

Child objects aren't loaded with their parents because they are lazily loaded. The query.execute() doesn't return the child fields. They are only loaded if you try to access it (with a data0.getItem(), for instance). In your case, your're trying to access the child object after you close the PersistenceManager, so they're aren't loaded.

2011년 3월 14일 월요일

JDOQL

  • As described below in the discussion of inequality filters, a query can only have one not-equal filter, and such a query cannot have other inequality filters.
  • In other words, || is only legal in situations where the filters it separates can be combined into a single contains() filter:
  • In other words, || is only legal in situations where the filters it separates can be combined into a single contains() filter:
  •  if a query specifies inequality filters on a property and sort orders on other properties, the property used with the inequality filters must be ordered before the other properties.