I have 2 table Tab1 and Tab2.
Mapping of "Tab1" to "Tab2" is one-to-many.
Code is like that :
private Collection< Tab2 > obj = new ArrayList< Tab2 >();
@javax.persistence.OneToMany(fetch=javax.persistence.FetchType.LAZY,
mappedBy = "Tab1")
public Collection< Tab2 > getTab2()
{
return Tab2;
}
public void setTab2( Collection<Tab2 > val )
{
this.Tab2 = val;
}
I want to fetch record from both table.
For example : Tab1 has column: Stu_Id, Stu_FirstName, Stu_LastName
Tab2 has column: Stu_Id(foriegn Key),Stu_Subject, Stu_Teacher
Now I want to fetch Stu_id from Tab1 and Stu_Subject,Stu_Teacher from Tab2