I have a class/mapping:
Code:
@Entity
@Table(name="A")
public class A
{
...
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="B_ID")
public B getB()
...
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="C_ID")
public C getC()
...
}
When I tried to get a list of A's, instead seeing only a single SQL statement, I see that hibernate is trying to load all the B's and C's as well. Also, the last association, in this case C, is always loaded via single selects whereas the other associations are loaded via join. So my log file looks like the following:
Code:
select A.1, A.2, ..., B.1, B.2, ...
select C.1, C.2, ...
select C.1, C.2, ...
select C.1, C.2, ...
...
Am I missing something here?
Hibernate version: 3.3.1
Database: Oracle 10g