Hi guys - a few comments on the public interfaces of SearchableCache -
1) IMO, I think that the SearchableCache.createQuery() method should
*not* return a FullTextQuery, but instead a JBCS-specific CacheQuery
interface with a subset of the methods in FullTextQuery.
I think the only methods in FullTextQuery that are relevant and that
should be carried across to CacheQuery are:
* list()
* iterator();
* setFirstResult(int i);
* setMaxResults(int i);
* setFetchSize(int i);
* getResultSize();
* setSort();
I think all of the rest - such as filters, criteria and projections -
are irrelevant to a query on a cache. WDYT? Emmanuel?
2) Also, rather than implement FullTextQuery.scroll() to return a
ScrollableResults instance, I'd rather that iterator() returns an
instance of a new interface, QueryResultsIterator, which extends
j.u.ListIterator. This gives us the ability to scroll back and forth
over a result set, and we could add additional methods to jump to a
specific point in the result set and helpers such as isLast(),
isFirst(), isBeforeLast(), isAfterFirst(), first(), last(),
afterFirst(), beforeLast().
I think that any benefit of a scrollable result set window preventing
loading unnecessary objects from a DB are lost when your backing store
is a cache and the objects are in memory anyway. And besides, any
further optimisations can be in the iterator implementation, such as
just maintaining a list of CachedEntityIds (a composite of Fqn and
key) and fetching the objects from the cache lazily, as required.
Also, with the above, 2, we don't leak any Hibernate or Hibernate
Search interfaces into the user API which again IMO is a good thing.
Thoughts, comments?
Cheers
Manik
On 24 Jun 2008, at 11:47, Navin Surtani wrote:
Begin forwarded message:
From: Emmanuel Bernard <[EMAIL PROTECTED]>
Date: 24 June 2008 08:19:03 BST
To: Navin Surtani <[EMAIL PROTECTED]>
Subject: Re: More hibernate questions
Scroll is more important than iterate because it allows to read
objects s a window and get rid of them on a regular basis without
facing out of memory exception.
I think it's used more often than iterate
On Jun 23, 2008, at 18:17, Navin Surtani wrote:
Hey again -
I have a CacheQueryImpl class that extends the FullTextQuery
interface and I am implementing the methods as similar as possible.
A couple of problems occur when you are taking in and using
certain Hibernate objects for example. A problem lies with the
scroll() method. I think it is very similar to the iterate()
method and does not need to be implemented in CacheQueryImpl. Do
you know if Hibernate users generally use this method and find
that they need it? If so then I will try and implement it
otherwise then I will just make it throw an exception.
Thanks again :)
Navin.
--
Manik Surtani
Lead, JBoss Cache
[EMAIL PROTECTED]
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev