spring-data-neo4j-4

How to add resource and specify related element?

☆樱花仙子☆ 提交于 2019-12-11 13:57:57
问题 I have a simple API for a game tip website: /class is the endpoint for in game classes /tip is the endpoints for the tips /user is the endpoint for the users Each tip has 3 relations: (:User)-[:AUTHORED]-(:Tip) (:Class)<-[:FOR]-(:Tip) (:Class)<-[:AGAINST]-(:Tip) When I create a Tip using POST , I do'nt know how to add relations at the create time. I can do this way: Add relation to another node in SDN4 + REST after creating the resource, but I want to do it with only one query. EDIT: I tried

SDN 4 + OGM 1.1.1 @Index(unique = true) is not working

核能气质少年 提交于 2019-12-11 11:28:02
问题 I know this question has been asked before, but looks like not with SDN 4 and OGM 1.1.1 Here is my code on the @NodeEntity @NodeEntity public class Company { @GraphId private Long id; @Index(unique = true) private String name; private String description; Here is the repo @Repository public interface CompanyRepository extends GraphRepository<Company> { Company findByName(String name); and I have a unit test class with methods @Autowired private CompanyRepository companyRepository; @Before

Neo4jServer in Neo4jConfiguration - 4.1.0?

懵懂的女人 提交于 2019-12-11 09:59:35
问题 I've been using the latest code in 4.1.0-BUILD-SNAPSHOT as I need some of the new bug fixes in the 4.1 branch and just noticed that "neo4jServer()" is no longer a method exposed by Neo4jConfiguration. What is the new way to initialize a server connection and an in-memory version for unit tests? Before I was using "RemoteServer" and "InProcessServer", respectively. 回答1: Please note, the official documentation will be updated shortly. In the meantime: What's changed SDN 4.1 uses the new Neo4j

Spring Data Neo4j 4.0.0: Can't Create Relationship Between Nodes with the Same Label

主宰稳场 提交于 2019-12-11 08:32:31
问题 I'm using Spring Data Neo4j 4.0.0 with Neo4j 2.2.1 and I'm trying to create a relationship between two nodes with the exact same labels. So, I have a NodeEntity class and I have a variable inside with the same Type as the class itself, and annotate it as Relationship. But, when I save the object to the database using the save() method of the repository object, the relationship can't be created. Thank you in advance and your suggestion would be really appreciated! EDIT Here is the node entity

How to I configure my own GraphDatabaseService and GraphAwareRuntime in a spring unit test with boot 2.0 and Neo4j SDN5

喜欢而已 提交于 2019-12-11 06:41:15
问题 I'm writing some unit tests and want to use TimeTree along with Spring repositories, to auto attach event nodes to a time tree. Something like this issue, but I'm using boot 2.0 and SDN5. I think my main issue is I don't know how to set up the configuration so my repositories and my TimeTree use the same GraphDatabaseService. My @Confuration is like this: @Configuration public class SpringConfig { @Bean public SessionFactory sessionFactory() { // with domain entity base package(s) return new

Testing with GraphAware Timetree

五迷三道 提交于 2019-12-11 06:29:56
问题 I've been starting to use GraphAware timetree for neo4j, and so far its working out pretty well. Now I'm trying to work out how I can unit / integration test my code that uses neo4j timetree. I've put together some code as below... but still I'm getting the message: org.neo4j.ogm.exception.CypherException: Error executing Cypher "Neo.ClientError.Procedure.ProcedureNotFound"; Code: Neo.ClientError.Procedure.ProcedureNotFound; Description: There is no procedure with the name `ga.timetree.events

SDN4 - Cannot findById with list of id

梦想的初衷 提交于 2019-12-11 04:42:28
问题 In old version, SDN3, I can use findById(List id), but after upgrade to SDN4, I cannot use this function again, always return empty. This is my sample class : @NodeEntity public class Right{ @GraphId Long graphId; String id; //random generated UUID String name; //Properties & Constructor } And then I have RightRepository that contain these code : public interface RightRepository extends GraphRepository<Right> { List<Right> findById(List<String> id); } Instead of use Loop to get per ID, I need

Spring Data Neo4j - ORDER BY {order} fails

巧了我就是萌 提交于 2019-12-11 04:14:50
问题 I have a query where the result should be ordered depending on the passed parameter: @Query("""MATCH (u:User {userId:{uid}})-[:KNOWS]-(:User)-[h:HAS_STUFF]->(s:Stuff) WITH s, count(h) as count ORDER BY count {order} RETURN o, count SKIP {skip} LIMIT {limit}""") fun findFromOthersByUserIdAndSortByAmountOfStuff( @Param("uid") userId: String, @Param("skip") skip: Int, @Param("limit") limit: Int, @Param("order) order: String): List<StuffWithCountResult> For the order parameter I use the following

Transactions and relationship entities mapping problems with Neo4j OGM

痞子三分冷 提交于 2019-12-11 04:13:06
问题 Versions used: spring-data-neo4j 4.2.0-BUILD-SNAPSHOT / neo4j-ogm 2.0.6-SNAPSHOT I'm having problems to correctly fetch relationship entities . The following fetch calls don't return consistent results (executed in the same transaction): session.query("MATCH (:A)-[b:HAS_B]-(:C) RETURN count(b) as count") returns 1 session.query("MATCH (:A)-[b:HAS_B]-(:C) RETURN b") correctly returns the relationship entity as a RelationshipModel object session.query(B.class, "MATCH (:A)-[b:HAS_B]-(:C) RETURN

Entity is not an instance of a persistable class NEO4J 4.0.0

不问归期 提交于 2019-12-11 03:53:09
问题 Spring data neo4j 4.0.0 Release In spring mvc project i am trying to save a node by repository.save() method i am getting error. @NodeEntity public class Category { @GraphId public Long id; public String categoryName; public Category() { } public Category( Long id, String categoryName ) { this.id = id; this.categoryName = categoryName; } } @Configuration @EnableNeo4jRepositories("org.neo4j.example.northwind.repository") @EnableTransactionManagement public class AppContext extends