[infinispan-dev] Infinispan Query entity discovery (Was: Re: new Infinispan Query API - ISPN-194)

Manik Surtani manik at jboss.org
Fri May 13 08:53:40 EDT 2011


Sorry for jumping in on this so late.


On 26 Apr 2011, at 22:32, Sanne Grinovero wrote:

> Hello,
> I'm forking off this thread, as we never resolved how to cope with the
> main issue:
> 
> how is Infinispan Query going to be aware of which entities are to be
> considered as default targets for a Query?
> 
> the realistic ideas so far:
> A) class scanning: seems nobody liked this idea, but I'll still
> mention it as the other options aren't looking great either.
> B) scan known indexes (need to define what the "known indexes" are as
> we usually infer that from the classes)
>   -- could enforce a single index
> C) have to list all fully qualified class names in the configuration
> D) don't care: consider it a good practice to specify all targeted
> types when performing a Query.
> E) please suggest :)
> 
> The currently implemented solution is D, as it requires no coding at all :)
> considering the simplicity of it I'm liking it more the more I think
> about it; I could even polish the approach by adding a single line to
> log a warning when the user doesn't respect the best practice, or to
> mandate it.
> 
> Considering that when a Query is invoked specifying the target types
> there is no doubt we know the classes, I could add a warning in case
> the Query is performed without specifying the type: in that case it
> usually implies the query targets all known types, which is always
> fine when using Hibernate Search, but could be inconsistent with
> Infinispan Query as it might not have discovered all types yet (1), so
> a very simple solution is to mandate the type parameter.

I think we should just mandate the types you expect to search, even if this isn't how Hibernate Search does things.  If you were to draw an analogy to JPA-QL or SQL, you will always provide a target to your FROM clause.

Cheers
Manik
--
Manik Surtani
manik at jboss.org
twitter.com/maniksurtani

Lead, Infinispan
http://www.infinispan.org






More information about the infinispan-dev mailing list