我尝试使用模型连接两个表。我以一对一的关系映射了表格,但是当我运行项目时,连接列的值为空
我的实体定义为:
@Entity
@Table(name="user")
public class User{
@Column(name="first_name") String firstName;
@Column(name="last_name") String lastName;
@Column(name="address") String address;
@Column(name="mobile_no") String mobileNumber;
@Column(name="gender") String gender;
@Column(name="photo") String photo;
@Column(name="website") String website;
@Column(name="email_address_id",updatable = false) UUID emailAddressId;
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "id") EmailAddress emailAddress; // this column is joined but I get a null value
}
我这样打:
List<User> users = test.findAll();
我仅获得User
表值,但无法获得EmailAddress
表值。