Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ManyToMany inverseJoinColumns side null fields

 
Sharmila Punde
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
Database table structure is as -

Please take a look at code which works fine -

I can see output of line #1 with list of 2 employees,
But somehow persistence provider do not initialize Employee.officeBranches , so the 'empsOfficeBranches'
on line #2 get initialized to null.
What is the problem with the above code? Why Employee.officeBranches does not get initialized
with list of OfficeBranch after en.refresh(ob) method call on line #0.

Thanks

 
Will Myers
Ranch Hand
Posts: 392
Java jQuery Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try adding fetch=FetchType.EAGER to the @ManyToMany annotations, the default is Lazy I think
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic