0

Using SDN 4.0 and having this entity, offering a tree of Interests (Parent and Children)

@NodeEntity
public class Interest {
    @GraphId
    private Long id;
    private Interest parent;    
    private List<Interest> children = new ArrayList<Interest>();
    private String label;
    public Interest(){

    }
    public Interest(Interest parent, String label) {
        super();
        this.parent = parent;       
        this.label = label;
        if (this.parent!=null && !this.parent.getChildren().contains(this))
            getChildren().add(this);
    }
    public List<Interest> getChildren() {
        return children;
    }
    public void setChildren(List<Interest> children) {
        this.children = children;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Interest getParent() {
        return parent;
    }
    public void setParent(Interest parent) {
        this.parent = parent;
    }
    ....  
}

and the repository

public interface InterestRptry extends GraphRepository<Interest>{
    public Page<Interest> findAllByParentIsNull(Pageable pageRequest);//
    public List<Interest> findAllByParentIsNull();//
}

No elements are returned by both syntaxe, what is the problem ?

This is probably du to the fact that parent is considered as a RelationChip and not a Property

This query do the job

MATCH (i:`Interest`) WHERE not(i-[:PARENT]->()) return i

but it cause an exception Spring Data Neo4j 4 : Failed to convert from type java.util.LinkedHashSet<?> to type org.springframework.data.domain.Page<?>

Community
  • 1
  • 1
Nassim MOUALEK
  • 4,702
  • 4
  • 25
  • 44

1 Answers1

1

SDN 4 does not yet support paging on derived finders. isNull is also not supported yet.

The workaround is to use a custom query.

Luanne
  • 19,145
  • 1
  • 39
  • 51
  • Could you please include this fix http://stackoverflow.com/questions/34322574/failed-to-convert-from-type-java-util-linkedhashset-to-type-org-springframewo in the next 4.0.x release – Nassim MOUALEK Dec 17 '15 at 06:57