I have a simple JPA entity (hibernate implementation) with an eagerly fetched relationship:
User.java:
@Entity
@Table(name = "USER")
public class User {
@OneToOne(optional=false)
@JoinColumn(name = "USER_STATUS_ID", nullable = false)
private UserStatus userStatus;
UserStatus:
@Entity
@Table(name = "USER_STATUS")
public class UserStatus {
@Column(name = "name", nullable = false)
private String name;
and the query that is being generated to lookup the entity looks something like this:
...from user left outer join user_status on...
My question is: why is Hibernate performing this outer join and not an inner join (since I've told it that it's not nullable or optional). Is there any way to force an inner-join?
Thanks.