• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

the many vs one sides of a cascaded hibernate object...

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys: I just ran into a strange redundancy / paradox in hibernate.
If I have an object (call it Bus) that has several passengers ...


and I execute the code


I get an "not null property ..." error.

This means that I have to explcitly do both

1) set the passenger collection in the bus object
and
2) set each passenger p to directly reference the bus b.

isnt this a bit redundant ?
is there a way that hibernate can synchronize implicit relationships collections for me before saving ???




 
Santosh Ramachandrula
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you have the right Bus object in Session then



should work(you have to commit the session).

If you still get the error can you please show the stacktrace?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic