File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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.


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

Joined: Aug 05, 2009
Posts: 370

Try adding fetch=FetchType.EAGER to the @ManyToMany annotations, the default is Lazy I think
I agree. Here's the link:
subject: ManyToMany inverseJoinColumns side null fields
It's not a secret anymore!