Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8717053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:13:30+00:00 2026-06-13T06:13:30+00:00

Recently I’ve been playing with Spring Data for Neo4j ( version 2.1.0.BUILD-SNAPSHOT ) and

  • 0

Recently I’ve been playing with Spring Data for Neo4j (version 2.1.0.BUILD-SNAPSHOT) and I’m having an issue related to its GraphRepository interface.

You can write a method that will search for a node of T class using the properties contained in the method’s name, like this:

public interface UserRepository extends GraphRepository<User> {
    public User findByUsername(String username);
    public User findById(Long id);
}

My User class:

@NodeEntity
public class User {

    @GraphId
    Long id;

    @Indexed
    private String username;

    private String password;

    ...
}

And my applicationContext.xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation=" 
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/data/neo4j
        http://www.springframework.org/schema/data/neo4j/spring-neo4j.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx.xsd">


    <context:spring-configured />
    <context:annotation-config />

    <context:component-scan base-package="package.for.services" />  
    <neo4j:repositories base-package="package.for.repositories" />

    <neo4j:config graphDatabaseService="graphDatabaseService" />
    <bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase"
        destroy-method="shutdown" scope="singleton">
        <constructor-arg value="/path/to/neo4j.db" />
        <constructor-arg>
            <map>
                <entry key="allow_store_upgrade" value="true" />
            </map>
        </constructor-arg>
    </bean>
</beans>

My issue is that findById(Long id) method does return a node with that specific id, but findByUsername(String username) does return null instead of a node with that specific username.

Any help will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:13:33+00:00Added an answer on June 13, 2026 at 6:13 am

    Solved by recreating the database. Deleted its directory and launched the application again.

    I guess the indexes have not been created correctly since the beggining, and Spring Data is not able to change them once they were already created.

    Thank you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently, I try to build WebKit with VS2012. That cost me a lot of
Recently downloaded some code for a minor open-source project related to a small webgame
Recently I've been doing quite the project mostly working with the DateTime class. Now,..
Recently I've been dealing with texts with mixed languages, including Chinese, English, and even
Recently I've been thinking about how to transform a complex polygon into a non-complex
Recently I've been experimenting with the use of the Func<T> class, and so far
Recently I have been dealing with windows LogonUser API. The LogonUser api returns different
Recently I was turned on to the opencv programming library for image and data
Recently, I was given a small task of using graph data structure as core
Recently I've been doing things like this: import Tkinter class C(object): def __init__(self): self.root

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.