Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Many to one object is null???

 
Gavin Tranter
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Having a major (for me) hibernate issue. I think I have final got my head around it enough to use it, and then it goes and does soething I cant figure out.

I have the following mapping:


In my User class i have a UserRole object. When I do a find on the User, I am expecting hibernate to have populated the UserRole object (preferable with the correct user role) but it dosnt it, its null.

So, what am I doing wrong, why isint the parent object pulled in as I would expect. It seems to find the User object without me having to have "loaded" the user table.

Bit confused here.

Thanks
G
 
Gavin Tranter
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate seems to load child (collections) into parent objects without any issue.....
 
Gavin Tranter
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Could the problem I am have be down to not having a many to one mapping in the parent tables mapping?

Thanks
G
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic