The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes ManyToMany inverseJoinColumns side null fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "ManyToMany inverseJoinColumns side null fields" Watch "ManyToMany inverseJoinColumns side null fields" New topic
Author

ManyToMany inverseJoinColumns side null fields

Sharmila Punde
Ranch Hand

Joined: Dec 26, 2007
Posts: 133
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


Regards, Sharmila.
We will have a future if we save Nature!
Will Myers
Ranch Hand

Joined: Aug 05, 2009
Posts: 331

Try adding fetch=FetchType.EAGER to the @ManyToMany annotations, the default is Lazy I think
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ManyToMany inverseJoinColumns side null fields