hi,
MyTable is a table in my Oracle DB, it has a CMP_ID to join the COMPANIES table.
Here is the Java implementation :
public class MyTable implements Serializable {
...
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumns( { @JoinColumn(name = "CMP_ID", referencedColumnName = "CMP_ID", nullable = false) })
@XmlTransient
Company company;
...
}
In my JSP Page, i managed to display the MyTable:
${MyTable.company.cmpName}
But Hibernate generated 2 SELECTs : one for the MyObject , and another one to fecth the Company name.
How do i fetch all the informations i want in only one query using Hibernate ? (all fields in MyTable, plus the Company name in the Companies table)
thank you