Synchronization error when insertable = false in E

2019-08-18 03:31发布

This my entity

@Entity
public class Order {

    ...
    @OneToMany (fetch = FetchType.LAZY)
    @JoinColumn(name="order_uuid", insertable = false, updatable = false)
    private List<Item> items;
}

When I create new Oder and save it in DB I get:

Caused by: java.lang.IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST: com.temp.Item@3cd8c5f.

Could anyone explain the reason of this error (I did add insertable = false) and how to fix it (I don't want to create new items when I create order)?

0条回答
登录 后发表回答