spring-data-neo4j

NodeBacked entity NPE - entityState is null

我的未来我决定 提交于 2019-12-24 16:18:18
问题 I've got a sample project which uses Spring Data Neo4j's advanced mapping using aspectj. It's failing in a test with NullPointerException due to the entityState attribute being null at the time when the entity is being persisted. I can also replicate this when the server itself is spun up and I execute: curl -i -X POST -H "Content-Type:application/json" -d '{ "firstName" : "Test", "lastName" : "Person" }' http://localhost:8080/people The project is at https://github.com/dhallam/spring-data

Implementing Lazy Loading in Spring Data Neo4j

拟墨画扇 提交于 2019-12-24 14:41:52
问题 Spring Data Neo4j doesn't have lazy loading. I want lazy loading in my project anyway. After all, what's really the point of having a getter if I can't rely on it to actually get what I want it to get every time? So to make my domain models be lazy loaded, I was thinking of annotating them as spring components and adding logic to my getters that lazy loads fields when I try to access them. I know this will strongly couple my models to neo4j, but I'd rather have that strong coupling than no

cypher PROFILE via neo4j REST API

孤街醉人 提交于 2019-12-24 14:28:35
问题 Can anyone tell me how to run a PROFILE'd query using teh neo4j REST API such as PROFILE MATCH (n:LABEL) return n; When I run this either in Java using the RestCypherQueryEngine or the even using a raw HTTP post directly I get message: "Invalid input 'P': expected SingleStatement (line 1, column 1) "PROFILE MATCH (n:LABEL) return n;" ^" exception: "SyntaxException" I though I had read somewhere that this is possible not only through the server console 回答1: The old cypher endpoint (i.e /db

spring-data-neo4j: Can't create two relationship properties with same label

微笑、不失礼 提交于 2019-12-24 13:00:07
问题 Using spring-data-neo4j, I am not able to set up two relationship properties in the same class with the same label. The following code can be found in my branch https://github.com/spencerhrob/gs-accessing-data-neo4j/tree/same-name-relationships. Person.java: @NodeEntity public class Person { @GraphId Long id; public String name; public Person() {} public Person(String name) { this.name = name; } @RelatedTo(type="MEMBER_OF", direction=Direction.OUTGOING) Dojo dojo; @RelatedTo(type="MEMBER_OF",

Neo4j: Native Java API(or equivalent cypher query) in Spring Data Neo4j

感情迁移 提交于 2019-12-24 11:35:19
问题 I was experimenting with Neo4j embedded-db in the past few days for a DEMO and was thoroughly impressed with the Native Java API's for indexing, lucene queries and even managed to do fuzzy search. I then decided to take this POC to production with Spring Data Neo4j 4.0 but ran into issues with Cypher queries and fuzzy search. My domain class "Team" looks like this: @NodeEntity public class Team { @GraphId Long nodeId; /** The team name. */ @Indexed(indexType = IndexType.FULLTEXT,indexName =

Neo4j Cypher query null or IN

霸气de小男生 提交于 2019-12-24 10:46:19
问题 I have a following cypher query: MATCH (parentD)-[:CONTAINS]->(childD:Decision)-[ru:CREATED_BY]->(u:User) WHERE id(parentD) = {decisionId} RETURN ru, u, childD SKIP 0 LIMIT 100 Decision entity can belong to 0..N Tenant objects @NodeEntity public class Decision { private final static String BELONGS_TO = "BELONGS_TO"; @Relationship(type = BELONGS_TO, direction = Relationship.OUTGOING) private Set<Tenant> tenants = new HashSet<>(); .... } I need to extend the Cypher query above in order to

Spring Data Neo4j 5 update dynamic properties

大兔子大兔子 提交于 2019-12-24 09:05:55
问题 I have the following entity: @NodeEntity public class Value { @Properties(prefix = "property", allowCast = true) private Map<String, Object> properties; } I have added the following properties: Map<String, Object> properties1 = new HashMap<>(); properties.put("key1", "one"); properties.put("key2", "two"); value.setProperties(properties1); Right now on the database level, I have the Value node with two properties: property.key1 = "one" property.key2 = "two" Now, I'd like to update the

'Error 401 Unauthorized' for Neo4j REST url on Heroku

让人想犯罪 __ 提交于 2019-12-24 08:24:59
问题 I am using correct NEO4J_URL environment variable as shown in heroku config . If I use the same neo4j url via a browser, it works fine (no auth failure). However my application fails to start with below error on heroku. (I am using spring-data-neo4j) The URL looks like http://username:password@123456ac6.hosted.neo4j.org:1234/db/data/ . Tried without '/db/data' at the end and also with and without trailing slash. Didn't help. Please help if anyone has already faced/resolved this issue. The

Neo4j Cypher comparing dates in Cypher query

好久不见. 提交于 2019-12-24 07:56:37
问题 Right now I'm designing a system with Neo4j database where I have to be able to have a query check if a Date property in a node is before, equal or after the provided Date . How should I store the Date inside of Neo4j Node property to be able to do a comparison with Cypher query based for example on simple operators like == , > , < Is it okay to store Date like Long timestamp ? Will it work this way ? If no, please suggest a better decision. UPDATED Queries I have tried with no luck: MATCH

SDN 4 : How to cause SDN 4 to use MERGE rather than CREATE

試著忘記壹切 提交于 2019-12-24 03:50:07
问题 Prior to migrating my project to SDN 4, I used my own custom REST client code which generated Cypher statements of the form: MERGE (n:LABEL1:LABEL2 {prop1:"val"...}) ON CREATE SET ... ON MATCH SET ... This had the desired effect of creating nodes which needed to be created, and updating existing nodes where necessary. However, using .save(...) on the SDN 4 Neo4jTemplate, only CREATE Cypher statements appear to be generated, resulting in duplicate nodes, where what is desired is new nodes are