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

  • Home
  • SEARCH
  • 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 8507625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:55:26+00:00 2026-06-11T02:55:26+00:00

I have a problem with derived finder methods of GraphRepository. Short version: User foundUser1

  • 0

I have a problem with derived finder methods of GraphRepository.

Short version:

User foundUser1 = userRepository.findByEmail("test@gmail.com");
User foundUser2 = userRepository.findByPropertyValue("id", 1);

works, but not:

User foundUser3 = userRepository.findById(1);

Long version:

test-context.xml

<context:annotation-config/>    
<neo4j:config storeDirectory="data/graph.db" />
<neo4j:repositories base-package="com.blbl.repository"/>
<tx:annotation-driven mode="proxy"/>

UserGraphRepository.java:

public interface UserGraphRepository extends GraphRepository<User> {
    public User findById(int id);
    public User findByEmail(String email);    
}

User.java:

@NodeEntity
public class User {
    @GraphId private Long nodeId;
    @Indexed(unique = true) private int id;
    @Indexed private String email;

    public User(int id) {
        this.id = id;
    }
    // getter & setters
}

Test:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"/test-context.xml"})
@Transactional
public class UserServiceTest {

    @Autowired
    private UserGraphRepository userRepository;

    @Autowired
    private Neo4jTemplate template;


    @BeforeTransaction
    @Rollback(value = false)
    public void cleanDb() {
        Neo4jHelper.cleanDb(template);
    }

    @Test
    public void testSaveUser() {
        User user = userRepository.save(new User(1));
        user.setEmail("test@gmail.com");
        userRepository.save(user);

        User foundUser1 = userRepository.findByEmail("test@gmail.com");
        User foundUser2 = userRepository.findByPropertyValue("id", 1);
        User foundUser3 = userRepository.findById(1);
        assertThat(foundUser1, is(notNullValue())); // SUCCESS
        assertThat(foundUser2, is(notNullValue())); // SUCCESS
        assertThat(foundUser3, is(notNullValue())); // FAILS
    }
}

third assert fails since foundUser3 is null. I don’t understand why this is happening while it can find with findByPropertyValue("id" ..). I wonder if id is some sort of keyword? (Note that my @GraphId is called nodeId)

PS:

<neo4j-version>1.8.M07</neo4j-version>
<org.springframework.version>3.1.2.RELEASE</org.springframework.version>
<org.springframework-data-neo4j.version>2.1.0.RC3</org.springframework-data-neo4j.version>
  • 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-11T02:55:27+00:00Added an answer on June 11, 2026 at 2:55 am

    This is probably an issue with special indexing of numeric fields. I raised an issue here: https://jira.springsource.org/browse/DATAGRAPH-294

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

Sidebar

Related Questions

I have problem with http://abfoodpolicy.com/ . In IE 8 and 9 the right sidebar
I have a problem with MFC dialog boxes that are drawn using derived MFC
My problem is similar to: Problem creating NSManagedObject derived class I have setup a
I'm having a little bit of problem with my derived class. Basically I have
I have problem with optimize this query: SET @SEARCH = dokumentalne; SELECT SQL_NO_CACHE `AA`.`version`
I have a problem with bitfields in derived classes. With the g++ compiler, you
I have a problem where I'd like to provide a generic version of a
I have a homework problem that asks: Desgin a derived class GraduateStudent from base
I have problem with my query on C, I’m using the oci8 driver. This
I have problem with repopulating form_upload after validation. Other input fields or selectboxes are

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.