get value from imported class for interface

60 Views Asked by At

Setting

I import a class from my Java project via

import myproj.domain.ActionResponse;

Then I try to make an interface for a repository with by extending a Neo4jRepository.

I am following these docs: "parameter types change from <T> to <T, ID>" - https://docs.spring.io/spring-data/neo4j/docs/current/reference/html/

@Repository
    public interface ActionResponseRepository extends Neo4jRepository<ActionResponse, ActionResponse.getId() >  {
...

ActionResponse extends NamedType which extends GraphType which has a

...
@GraphId
    @JsonProperty("id")
    Long id;

    public Long getId() {
        return id;
    }
...

Question

This: extends Neo4jRepository<ActionResponse, ActionResponse.getId() > is incorrect syntax.

How do I fill the second parameter field with the id from the ActionReponse class?

1

There are 1 best solutions below

0
On BEST ANSWER

The second parameter of the annotation is the ID type.

So you should declare something like:

extends Neo4jRepository<ActionResponse, Long>