以下の Cypher クエリがあります。プレーヤーのリストと、各プレーヤーがプレーしたすべてのリーグのリストを返します。Person
NodeEntity
ここで、返されたプレーヤーごとに、を使用する代わりにを作成したいと思いますNodeProxy
。これを行う効率的な方法は何だろうか。
String q = "START t=node({teamId}) MATCH player-[:PLAYED_WITH_TEAM]->t-[:CONTESTED_IN]->league WITH player AS player, league.startDate AS startDate, league.name AS leagueName ORDER BY startDate RETURN player, collect(leagueName) AS leagueNames";
Map<String, Object> params = Maps.newHashMap();
params.put("teamId", selectedTeam);
Result<Map<String, Object>> result = template.query(q, params);
final List<Player> players = new ArrayList<Player>();
result.handle(new Handler<Map<String, Object>>()
{
@Override
public void handle(Map<String, Object> value)
{
players.add((Player) value.get("player"));
}
});
例外
SEVERE: Servlet.service() for servlet [appServlet] in context with path [/avl] threw exception [Request processing failed; nested exception is java.lang.ClassCastException: org.neo4j.kernel.impl.core.NodeProxy cannot be cast to com.aravind.avl.domain.Player] with root cause
java.lang.ClassCastException: org.neo4j.kernel.impl.core.NodeProxy cannot be cast to com.aravind.avl.domain.Player
at com.aravind.avl.controller.RegistrationController$1.handle(RegistrationController.java:103)