Hibernate version:
Hibernate 3.1.2, Hibernate-Annotations 3.1beta8
I'm a little confused about the strategy used to fetch a single-ended association. For example, I have this mapping:
Code:
@Entity
@Table(name="STAFF_MEMBERS")
public class MutableStaffMember implements StaffMember {
...
@ManyToOne(targetEntity=MutableRole.class, fetch=FetchType.EAGER)
@JoinColumn(name="ROLE_TYPE_ID", nullable=false)
public Role getRole() {
return role;
}
}
When retrieving a list of StaffMember with this HQL query:
Code:
FROM MutableStaffMember AS msf WHERE msf.role MEMBER OF MutablePhoenixRole
I see on the log that all roles are fetched using SELECT. When using mapping files, we have the
outer-join="true|false" option to choose the fetch strategy, but AFAIK there's no way to do so with annotations.
I know the performance issue of the SELECT fetching can be solved with second-level cache, but is there any way to force the fetching strategy using annotations?
Thanks,
Alex.