Neo4j SDN prepopulate entity

I have a following Neo4j SDN entity:

public class Comment {

    private final static String COMMENTED_ON = "COMMENTED_ON";
    private final static String CREATED_BY = "CREATED_BY";

    @RelatedTo(type = COMMENTED_ON, direction = Direction.OUTGOING)
    private Commentable commentable;

    private String text;

    @RelatedTo(type = CREATED_BY, direction = Direction.OUTGOING)
    private User author;


and a following SDN repository method:

@Query("MATCH (c:Comment) WHERE id(c) = {commentId} RETURN c")
Comment findOne(@Param("commentId") Long commentId);

As a result of this method invocation I have Comment object with only.

How to change this method(or Cypher query) in order to prepopulate also ?


You either have to annotate the author field with @Fetch (which fetches the full author eagerly.

Or you can call template.fetch( if needed case by case.

Need Your Help

python: advanced python scheduler - cron style scheduling - pass function parameters

python cron scheduler

I am trying to schedule con style job using advanced python scheduler. Everything is fine whenever I use function that does not require any parameters, however I am unable to schedule the same job

Rails4 Paperclip attachments not working in production

ruby-on-rails paperclip

I'm trying to upload Avatars to Users and it's working in development but not in production