嗨,我无法理解为什么会发生这种情况,因为我保存了一个新实体,它保存了所有列,但没有加入表列,并且下面给出的用于保存新实体的代码都没有抛出异常..
newEntity=setPropsFromTransientFields(newEntity,"newEntity");
sess.save(newEntity);
但是当我尝试更新现有记录时,它会成功保存连接表列
persistedEntity=setPropsFromTransientFields(persistedEntity,"updateEntity");
sess.saveOrUpdate(persistedEntity);
下面给出的连接表映射
@ManyToMany(targetEntity=TechnologyProduct.class)
@JoinTable(
name = "contact_technology",
joinColumns = @JoinColumn(name="contact_id", referencedColumnName="id"),
inverseJoinColumns = @JoinColumn(name="technology_id", referencedColumnName="id")
)
public List<TechnologyProduct> getTechKeywords() {
return techKeywords;
}