Web サイトで Spring Data Neo4j 3.0.0 を使用しています。
開発を行う際に問題があります。@NodeEntity モデル クラスで @Query アノテーションを使用します。
@Query(value = "START a=node({self}) MATCH (a)<-[:`COMMENT_TO`]-(b) RETURN b ORDER BY b.createdAt DESC")
private Set<BaseComment> sortedComments;
そして、私はこの結果を使用しようとしています...そして、sortedCommentsタイプはSpringEndResultでした。この結果を Set に使用するにはどうすればよいですか?
これを .jsp で使用できますか? JSTL(c:foreach)を使用してjspでsortedCommentsを使用する場合。SpringEndResult にはプロパティ例外がないことがわかりました。
私は英語ネイティブではありません。ご返信ありがとうございます。:)
@Test
public void getList() {
List<SimpleArticle> articles = articleService.getAll(0, 10).getContent();
for (SimpleArticle simpleArticle : articles) {
Set<BaseComment> comments = simpleArticle.getSortedComments();
for (BaseComment baseComment : comments) {
log.info(baseComment);
}
}
}
そして会った
java.lang.ClassCastException: org.springframework.data.neo4j.rest.SpringEndResult cannot be cast to kr.carcare.model.bbs.BaseComment
これは私のドメインクラスです
public class SimpleArticle extends BaseArticle {
@RelatedTo(type = "COMMENT_TO", direction = Direction.INCOMING)
@Fetch
private Set<BaseComment> comments;
@Query("START a=node({self}) MATCH (a)<-[:`COMMENT_TO`]-(b) RETURN b ORDER BY b.createdAt DESC")
private Set<BaseComment> sortedComments;