Retrieve all post of a user

We have 2 nodes

public class User {
    private String id;
    private String name;
public class Post {

    @GeneratedValue(generatorClass = GeneratedValue.UUIDGenerator.class)
    private UUID id;
    private String text;
    private Instant createdAt;

    @Relationship(type = "AUTHOR", direction = Relationship.Direction.INCOMING)
    private User author;

and we are trying to retrieve all the user's posts

@Query(value = "MATCH (author:User)-[:AUTHOR]-(post:Post) RETURN post, author",
            countQuery = "MATCH (author:User)-[:AUTHOR]-(post:Post) RETURN count(post)")
    Page<PostEntity> findPageByUserId(String userId, Pageable pageable);

We retrieve all the posts, but author is null in the Post class
How to retrieve also the author?

You would also have to return the relationships (to be sure that only the correct types are mapped):

MATCH (author:User)<-[r:AUTHOR]-(post:Post) RETURN post, collect(r), collect(author)
would be the way to go. Please use the collects for now, even that this is a 1:1 relationship because the mapping part is a little bit picky. There is already a change but not yet released.