• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic