Hi all,
we are using Hibernate 3.2.0 and Spring. No hbm.xml files, just annotations.
I wonder whether there is a way to configure Hibernate to fetch @OneToOne unidirectional relations in one select when fetching owning entity.
Entities are joined by FK.
For example
Code:
SELECT a FROM SomeObject a
always produces a bunch of selects to retrieve 1-1 associations.
To get entity in a single select you have to explicitly specify left join fetch in JPQL query, none of config options or Hibernate annotations worked, for example
Code:
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name="some_fk")
@LazyToOne(value = LazyToOneOption.FALSE)
@Fetch(value = FetchMode.JOIN)
has no effect
Am I missing something here or is it the explicit query the only option ?
Thank you for any info