Hi to all,

I understand this means we'll be simply enabled to do a

customerRepository.findByPropertyValue("name", "Smith");

instead of

(Customer)personRepository.findByPropertyValue("name", "Smith");

although "@Indexed String name" is declared only in Person. Is that right ?

Could these @Indexed fields be replicated in a separate index per class,
thus also getting the separate index speed improvement ? (i,e searching only
among my 1000 customers, instead of the 1000000 persons)

Also, it would interesting to have a method with generics like

personRepository.findByPropertyValue(Class<T extends Person> class, "name",
smith")

that searches and returns objects of some subclass of Person.

Regards




On Tue, Sep 13, 2011 at 12:17 PM, Michael Hunger <
[email protected]> wrote:

> Hey Gonfi,
>
> thanks for the feedback.
>
> The only issue with having @NodeEntity on the parent are the indexing
> queries.
>
> Otherwise there are no issues I know of.
>
> So what I'm thinking of is to add a "level" attribute to the @Indexed
> annotation, which can have the following values:
>
> * global -> index name "nodes" is used
> * type -> index name for the type where the field declared is used
> * instance -> index name for the type of the actual instance is used
>
>
> Does this cover the issues mentioned?
>
> Michael
>
> Am 13.09.2011 um 11:02 schrieb Gonfi den Tschal:
>
> > The inheritance model as described here
> >
> http://forum.springsource.org/showthread.php?108657-Inheritance-in-spring-data-graph
> > is nice when one wants to do polymorphic queries, when the types
> > should be looked at together at once.
> > For example Person with Customer and Employee and a general search is
> desired.
> >
> > However, when the types should be treated separately, and they just
> > happen to have a common superclass because
> > they share common functionality then I'd wish to have something like
> > JPA @MappedSuperclass.
> > As it is now, when I annotate my subtypes with @NodeEntity then the
> > attributes of the superclass are simply ignored.
> > There is no annotation to also include those fields in the Entity.
> >
> > This means I'm left with the 2 choices:
> >
> > 1) The subtypes have the @NodeEntity annotation.
> > Move all fields down to the impls, which can cause a lot of
> > boilerplate code. Using a common parent class becomes
> > almost useless. Then, the Repository interfaces (those extending
> > GraphRepository) are created for each subtype, and
> > the types are queried separately.
> >
> > 2) The supertype has the @NodeEntity annotation.
> > Keep the common fields in the superclass. If there is an @Indexed
> > String then it can be queried only through the
> > parent class (the Repository for the parent class). If one wants to
> > only find certain subtypes then he has to loop through
> > the result and filter. With millions of objects, as is the case for
> > me, this is the higher cost.
> >
> > So my wish is to have the @MappedSuperclass feature. And it would be
> > nice if such facts were documented so
> > that not everyone has to ask or figure out himself by trial and error.
> > My assumptions caused me to change code back
> > and forth a couple of times. It seems to me that the developers are
> > spending a lot of their time answering questions.
> >
> > best,
> > gonfi
> > _______________________________________________
> > Neo4j mailing list
> > [email protected]
> > https://lists.neo4j.org/mailman/listinfo/user
>
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to