Home JPA @Convert in @Embeddable triggers unnecessary delete insert
Reply: 0

JPA @Convert in @Embeddable triggers unnecessary delete insert

user1350 Published in May 21, 2018, 11:01 am

We have the following JPA entities:

@Table(name = "T_PRIZE")
public final class Prize
    @Column(updatable = false)
    private long id;

    private Target target;

public final class Target
    @CollectionTable(name = "T_CUTOFF", joinColumns = @JoinColumn(name = "PRIZE_ID"))
    private List<CutOff> cutOffs = new LinkedList<CutOff>();


public final class CutOff implements Serializable
    @Convert(converter = PenaltiesConverter.class)
    private List<IPenalty> penalties;

With above configuration we find so many delete-inserts on table T_CUTOFF even if we don't touch Prize entity. Even simple native 'select SEQ.nextval from DUAL' will trigger delete-insert.

This behavior leads to intermittent bugs in our app where updates to the CutOff entity seems to be not persisted in DB, but it turns out that another thread performs delete-insert on the same table afterwards.

If we remove the @Convert field than the unnecessary delete-inserts no longer happen.

We're aware of JPA auto flush feature, but is this the expected behavior with @Convert in @Embeddable ?

Any help would be greatly appreciated.

Thanks & Regards,


You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.325229 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO