您好,我得到了以下实体类书籍:$
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@OneToOne(cascade=CascadeType.PERSIST)
private BookProfile bookProfile;
@OneToMany(cascade=CascadeType.PERSIST , orphanRemoval=true, fetch=FetchType.EAGER)
private List<Rating> ratings;
$
我尝试添加这样的配置文件:
$
Book book = manager.find(Book.class, bId);
BookProfile bookProfile = new BookProfile();
manager.getTransaction().begin();
book.setBookProfile(bookProfile);
manager.merge(book);
manager.getTransaction().commit();
$
但是没有任何反应,Book 中的配置文件仍然为空。我究竟做错了什么 ?