Hey,
I have the following relation:
Code:
@Entity
public class UserEntity {
...
@OneToOne(cascade = { CascadeType.ALL})
Address add = new Address();
...
}
I have the following query:
Code:
select userE from UserEntity as userE
When i do the query, i want to override the mapping (eager/lazy), but what I see is that it run one select for all user and for each user it run individual select to get the address.
In this case the relation is eager (I am working with JPA above Hibernate and OneToOne default is eager) , so when it load User it also load Address and it does it for each user.
I want in query to get the control on the fetching; I don’t want to bring objects, which weren’t defined explicitly in the query.
Is there a way to do this?
Thank you