可能吗?我尝试这样做,但它不起作用:
StatelessSession sess = getSessionFactory().openStatelessSession();
sess.beginTransaction();
MessageDetails md = (MessageDetails) sess.get(MessageDetails.class,1189469L);
md.setCc(null);
sess.update(md);
sess.getTransaction().commit();
sess.close();
cc 是这样定义的:
@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinTable(name = "MessageEntryCc")
public Set<EmailAndName> getCc() {
return cc;
}
运行代码后,MessageEntryCc 仍然包含 message_details_id = 1189469 的条目...