JPA/Hibernate preUpdate doesn't update parent object

前端 未结 2 1113
执念已碎
执念已碎 2021-01-06 04:41

In my application I defined following classes:

@Entity
@Table(name = \"forums\")
public class Forum {
    @Id
    @GeneratedValue(generator = \"system-uuid\"         


        
2条回答
  •  南笙
    南笙 (楼主)
    2021-01-06 04:54

    post.merge() has no use here. post is clearly attached to the session already.

    Make sure you've got the content attribute mapped to a column, if it is not, Hibernate has no way of telling if the entity is dirty, and therefore flush the changes to the DB.

提交回复
热议问题