On 13 September 2012 17:24, Ales Justin <[email protected]> wrote:
> While thinking about EntityLoader as interface (imo, it should be an 
> interface ...),

+1, feel free to patch it, but before jumping on it make sure you need
to replace it; I'm not sure of that.

> just stumbled upon this:
>
>    public List<Object> load(EntityInfo... entityInfos) {
>       int size = entityInfos.length;
>       ArrayList<Object> list = new ArrayList<Object>(size);
>       for (EntityInfo e : entityInfos) {
>           Object entity = load(e);
>           if (entity != null) {
>               list.add(entity);
>           }
>       }
>       return list;
>    }
>
>
> We pass "size" into ArrayList.
> What if some "entity" is the null, hence not added, will the "list" size 
> still be ok?
> I would say you need to call "trimToSize"?

No that's not needed.

>
> @Sanne: how would we get just key to be used / loaded, not full entity;
> e.g GAE has Query::setKeysOnly
> ... you mentioned some projections

I was referring to the following Hibernate Search capability:
http://docs.jboss.org/hibernate/search/4.2/reference/en-US/html_single/#projections

In short:

org.hibernate.search.FullTextQuery query =
    s.createFullTextQuery( luceneQuery, Book.class );
query.setProjection( "id" );
List results = query.list();

But I just realized Infinispan Query doesn't implement _setProjection_ :-(
Open a feature request?
I'd prefer we implement projections over converting the EntityLoader
to an interface.

Sanne

>
> -Ales
>
>
> _______________________________________________
> infinispan-dev mailing list
> [email protected]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
_______________________________________________
infinispan-dev mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/infinispan-dev

Reply via email to