fetching from cache without sql transaction

abapseres <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <[email protected]>
Hello,

I would to know if it's possible to fetch newObject directely from cache with ObjectSelect.

For now i don't manage to do this, for example when I make something like that :


List<MyTable> list1 = ObjectSelect.query(MyTable.class)

    .cacheStrategy(QueryCacheStrategy.LOCAL_CACHE,"MyGroup")

    .select(getObjectContext());


MyTable o1 = getObjectContext().newObject(MyTable.class);

o1.setName("nouveau");

getObjectContext().commitChanges();



List<MyTable> list2 = ObjectSelect.query(MyTable.class)

    .cacheStrategy(QueryCacheStrategy.LOCAL_CACHE,"MyGroup")

    .select(getObjectContext());


For result list1 and list2 have same size, i have to switch QueryCacheStrategy to LOCAL_CACHE_REFRESH to get new row, but there is a database transaction.


Thanks
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.