Synchronization error when insertable = false in EclipseLink

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Synchronization error when insertable = false in EclipseLink

Alex Sviridov
Hi all,

Could anyone help to solve the following problem. This is the entity

@Entity
public class Order {

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

When new Oder is created and saved it in DB this error is thrown:

    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.

We also tried this variant:


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

but result was the same.

How explain the reason of this error (insertable = false) and how to fix it (We don't want to create new items when we create order)?


Best regards, Alex Sviridov
_______________________________________________
eclipselink-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/eclipselink-users