openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cheng Zhang" <>
Subject unexpected update when using many to many relationship
Date Thu, 04 Mar 2010 17:37:47 GMT


I found that, if I use many-to-many relationship, there will be
unexpected update when the transaction is closed.


Here is my code,



@Table(name = "MC_SUBJECT")

public class Subject implements Serializable {



    private String id;



    private Date createdDate;



    private String createdBy;


    @Column(length=128, nullable=false)

    private String title;


    @Column(length=128, nullable=false)

    private String subjectType;



    private String description;



    private Date modifiedDate;



    private String modifiedBy;



    @JoinTable(name = "MC_CHILD_SUBJECT", joinColumns = {
@JoinColumn(name = "SUBJECT_KEY") }, inverseJoinColumns = {
@JoinColumn(name = "CHILD_SUBJECT_KEY") })

    private List<Subject> childSubjectCollection;


...... getters and setters



In my code, I just read some Subject records. In the log file, I can see
some update statement.


However, if I change the many-to-many to one-to-many, everything is fine
and no update.


Is it expected behavior?







  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message