movies-java-spring-data-neo4j | Neo4j Movies Example with Spring Data Neo4j | Graph Database library
kandi X-RAY | movies-java-spring-data-neo4j Summary
kandi X-RAY | movies-java-spring-data-neo4j Summary
How to use Spring Boot, Spring Data, and Neo4j together. Spring Data Neo4j enables convenient integration of Neo4j in your Spring-based application. It provides object-graph mapping (OGM) functionality and other features common to the Spring Data projects. The example project is described in detail on the Neo4j Developer Site. The project uses Java 11.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Search for movies by title
- Search for movies by title
- Removes wildcards from title string
- Get the graph
- Get the session for the given database
- Fetching graph from database
- Start the downloader
- Downloads a file from the given URL
- Get movie details by title
- Fetch details by title
- The sample application
- Compares two MovieResultDto objects
- Compares this MovieDetailsDto
- Returns true if this member with the specified name and role are equal
- Select a database to use
- Converts a record to a MovieDetails
- This method produces a unique hash code for the job
- This method generates a unique hash code
- Returns a hashCode of the movie
movies-java-spring-data-neo4j Key Features
movies-java-spring-data-neo4j Examples and Code Snippets
Community Discussions
Trending Discussions on movies-java-spring-data-neo4j
QUESTION
Here's MVCE: https://github.com/neo4j-examples/movies-java-spring-data-neo4j
I added to Person entity method:
...ANSWER
Answered 2019-Jul-26 at 11:32I am not familiar with neo4j however would guess that it the fact that the test runs in a @Transaction
and the code executed by command line runner does not.
Therefore remove the logic from command line runner to some place where it can be wrapped in a transaction, either a service class or application listener.
QUESTION
In an attempt to recreate the Spring Data Neo4j official Movies example in Scala I have ran into an issue jsonifying on the Spring Data Neo4j layer.
The details are noted in the README
in this example project.
Booting the Spring app and hitting /movies/
gives the following stacktrace:
018-03-27 15:33:23 WARN DefaultHandlerExceptionResolver:442 - Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Invalid Object Id definition for movies.Movie: cannot find property with name 'id'; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Invalid Object Id definition for movies.Movie: cannot find property with name 'id' (through reference chain: org.springframework.hateoas.PagedResources["_embedded"]->java.util.Collections$UnmodifiableMap["movies"]->java.util.ArrayList[0])
I have opened an official Spring Data Neo4j JIRA issue here.
Edit: After the latest comment, I have removed unrelated theories about the root cause from this post. And I have updated the example project to expose the IDs on the Spring Data Rest
layer using a PostConstruct
method (thanks @meistermeier). I also tried the RepositoryRestConfigurerAdapter
method. However, the original HttpMessageNotWritableException
persists. Any ideas?
Update:
Modeling Movie.scala
after SDN-University example, I tried using com.voodoodyne.jackson.jsog.JSOGGenerator
as an Object ID Generator. I can successfully hit /movies/
but the only key is "id", and it's simply an index, and not the actual id. However, 38 movies do return, the amount in the Movies data set. I would think this narrows down the issue to the jsonfying part.
Update 2:
By using a bandaid to manually form the json
in the controller (using an object-to-map
function, and a map-to-json
function) I am finally able to send data out through the endpoints. I have updated the example project to demonstrate this. I can successfully retrieve objects from the movieRepository
, and manipulate them as I please. I think this has clearly narrowed down the problem to the jsonification. Does anyone have a clear example (Java or Scala) on how to properly annotate NodeEntity
with JsonIdentifyInfo
?
ANSWER
Answered 2018-Mar-30 at 08:16First a note on the id as String
part: The internal Neo4j id has to be of type Long
(paragraph between the info sections here: https://neo4j.com/docs/ogm-manual/current/reference/#reference:annotating-entities:entity-identifier). With another type than Long
Neo4j OGM is unable to find the, so called, native id field on your class.
Now back to the initial problem you are facing.
Spring Data Rest suppresses the exposure of id-like fields and Spring Data Neo4j will mark/register fields with an @Id
annotation as such.
To use this id fields you could for example do something like this:
QUESTION
I am learning this example:
https://github.com/neo4j-examples/movies-java-spring-data-neo4j
In this MovieRepository, this is the path setting:
...ANSWER
Answered 2018-Feb-18 at 14:18This is described in the Spring Data REST documentation
To have your results sorted on a particular property, add a sort URL parameter with the name of the property you want to sort the results on. You can control the direction of the sort by appending a , to the the property name plus either asc or desc. The following would use the findByNameStartsWith query method defined on the PersonRepository for all Person entities with names starting with the letter "K" and add sort data that orders the results on the name property in descending order:
QUESTION
I'm trying to create an example how to remove an relationship at neo4j using spring data rest service. You can use neo4j-movies-example to test.
If I get information about person 1 I see there is one film
...ANSWER
Answered 2017-Aug-17 at 09:29There is a settings to enable the OpenSessionInViewInterceptor in Spring Boot application.properties:
QUESTION
On Ubuntu 16.10 I have followed the instruction from:
https://github.com/neo4j-examples/movies-java-spring-data-neo4j-4
But when I go to http://localhost:8080/ and try to search for e.g. Matrix nothing happens, it just looks empty:
I have verified that the neo4j db has been populated with the required data and I also updated user/pass in the .properties
file in the maven project.
Any ideas, and is it possible to find a log somewhere?
Pressing F12 in Firefox gives:
Indicating the error in the sources as described in the below answer, did not manage to get the same error info in Chrome when pressing F12 though.
...ANSWER
Answered 2017-Jun-24 at 05:50The code in the GitHub project is not properly updated. The MovieRepository.java
class has findByTitleContaining
method and @param
is missing in this method. If you check the index.html
file, javascript code is executing /movies/search/findByTitleLike?title=*
URL. The quick fix will be add following method in MovieRepository.java
and then execute mvn spring-boot:run
command again.
QUESTION
I'm trying to setup the Spring Data Neo4j 4 neo4j movies example found at https://neo4j.com/developer/example-project/
The link to the code is at https://github.com/neo4j-examples/movies-java-spring-data-neo4j-4
I have everything up and running locally. Two of the three components are working, the list of movies and the background graph. What isn't working is the displaying of an individual movie on the right.
This information is populated starting at the following code
index.html (starting at line 82):
ANSWER
Answered 2017-Mar-15 at 03:46I was able to get a different example, with the same structure, to work: https://github.com/springframeworkguru/spring-boot-neo4j-example then modify it to do what my original example was attempting to do. Then, I was able to compare the differences between the two projects, apply the differences to the original project and have it behave correctly. Following are all the code differences to make it work correctly:
index.html (line 105) comment out line, not needed
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install movies-java-spring-data-neo4j
You can use movies-java-spring-data-neo4j like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the movies-java-spring-data-neo4j component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page