iPhoneJavaDev
iPhoneJavaDev

Reputation: 825

Cannot coerce LIST OF ANY? to Java String

I have Link nodes connected to other Link nodes. I am using latest version of spring-boot-starter-data-neo4j and Lombok.

My Link node is as follows:

@Node
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Link {

    @Id
    private String linkId;
    private String name;
    @Relationship(type = "IS_LINKED_TO")
    public List<Linkage> linkages;

}

and my Linkage relationship is as folows:

@RelationshipProperties
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Linkage {

    @RelationshipId
    private String id;

    @TargetNode
    private Link link;

    private Integer length;

}

My repository as follows:

public interface LinkRepository extends Neo4jRepository<Link, String> {
}

When I called linkRepository.findAll(), I got the following warning and error:

The query used a deprecated function: `id`.

org.neo4j.driver.exceptions.value.Uncoercible: Cannot coerce LIST OF ANY? to Java String

Please advise.

Upvotes: 0

Views: 248

Answers (1)

meistermeier
meistermeier

Reputation: 8262

The query used a deprecated function: id.

The warning originates from the Cypher runtime in Neo4j itself and is broadcasted via the Neo4j Java driver into Spring Data Neo4j. At the moment this is nothing to worry about. If you want Spring Data Neo4j to stop visually logging this, you can make use of dedicated loggers (https://docs.spring.io/spring-data/neo4j/reference/appendix/logging.html). In your case this would be the org.springframework.data.neo4j.cypher.deprecation logger that needs to be set to error instead of "just" warning.

org.neo4j.driver.exceptions.value.Uncoercible: Cannot coerce LIST OF ANY? to Java String

I assume that there is something wrong with the data within your Neo4j instance. Since the only real String I can see in your example that represents non-id data is name I think that maybe one of your entries does not have a String but maybe a String[] set.

Upvotes: 0

Related Questions