• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

node to traverse cannot be null! - problem with a simple one to many query

 
Ray Clark
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had 2 tables set up without any relationship specified in the objects and the query worked fine. I changed the objects to specify the one to many relationship and now I get the error "node to traverse cannot be null!".

Here is a snippet of the domain objects:

These are two methods from the DAO. The first method is the one that worked fine before adding the one to many relationship.

The DAO methods are actually being called from a JUnit test. I wouldn't think that would be a problem though.

I'm guessing that I have something wrong in my domain classes. Any ideas?

Thank you for your time.
Ray
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please include the full exception and stack trace.
 
Ray Clark
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply.

After some trial and error I was finally able to get it to work. To keep this short I will post only what I had to change.



As you can see I had my OneToMany and my JoinColumn annotations set up incorrectly. (New to JPA/Hibernate)

My question now is, does the OneToMany require the variable to be a Set/HashSet? Can it be a List/ArrayList?

Thank You,
Ray
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic