admin管理员组文章数量:1180433
Parent class
@Node
@NoArgsConstructor
@AllArgsConstructor
public class Dish {
@Id
private String dishName;
@Relationship(type = "CONTAINS", direction = Relationship.Direction.OUTGOING)
private List<Ingredient> ingredients;
private String recipeUrl;
private String cuisine; // New field for cuisine
private String dishType; // New field for dish type
// Getters and Setters for all fields
Child class
@Getter
@Setter
public class Ingredient {
@Id
private String nameInEnglish;
private String nameInHindi;
private String nameInGerman;
mapping in neo4j
MATCH (d:Dish {dishName: 'Paneer Butter Masala'}),
(i1:Ingredient {nameInEnglish: 'Paneer'}),
(i2:Ingredient {nameInEnglish: 'Butter'}),
(i3:Ingredient {nameInEnglish: 'Tomato'})
CREATE (d)-[:CONTAINS]->(i1),
(d)-[:CONTAINS]->(i2),
(d)-[:CONTAINS]->(i3);
neo4j browser returns one dish with one ingredient
MATCH (d:Dish)-[:CONTAINS]->(i:Ingredient)
WHERE i.nameInEnglish = "Paneer"
RETURN d,collect(i) as ingredients
but Java response has 1 dish with an ingredient arraylist always empty.
本文标签: Cannot fetch child entity (contains) in springdataneo4jStack Overflow
版权声明:本文标题:Cannot fetch child entity (contains) in spring-data-neo4j - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738141303a2065712.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论