spring-projects / spring-data-neo4j

Provide support to increase developer productivity in Java when using Neo4j. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
http://spring.io/projects/spring-data-neo4j
Apache License 2.0
831 stars 618 forks source link

Set<RelationshipEntity> [DATAGRAPH-373] #939

Closed spring-projects-issues closed 11 years ago

spring-projects-issues commented 11 years ago

David Gommeren opened DATAGRAPH-373 and commented

If I have:

@RelationshipEntity public class IndexedRelation\ { @EndNode @Fetch private E endNode; ...

and

public class IndexedCollection\ extends LinkedHashSet<IndexedRelation\> { ...

I can't do:

@RelatedToVia (type = "attributes") @Fetch private IndexedCollection\ myClasses = new IndexedCollection<>();

Runtime error: Caused by: org.springframework.data.mapping.model.MappingException: Relationship field with RelationshipEntity class nl.abacus.pim.meta.core.model.blueprint.AttributeDef annotated with @RelatedToVia

I have to add the RelationshipEntity in the generics, e.g.: public class IndexedCollection<IndexedRelation,E> extends LinkedHashSet ...


Affects: 2.2.1

spring-projects-issues commented 11 years ago

Michael Hunger commented

Does this workaround work for you? I think we don't support extending collection classes as entities which is a dangerous design anyway. Better encapsulate the set in a "Collections" object

spring-projects-issues commented 11 years ago

Michael Hunger commented

Oh and indexed collections are not supported / represented in the graph (aka we don't store any order right now). That's why the set semantics is the maximum you can get. And List support is only there for convenience

spring-projects-issues commented 11 years ago

Michael Hunger commented

See comments