openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject @OneToMany/@ManyToOne Weirdness (List contains non-matching elements)
Date Mon, 19 Jan 2009 10:20:13 GMT
Hello Everybody,

I'm having some weird issues with a simple OneToMany/ManyToOne Situation. 
The data model is as follows:

@Table(name = "REFERENZCODES")
public class ReferenzCode
    @Column(name = "RFC_CODE")
    private String code;
    @Column(name = "RFC_BEZEICHNUNG")
    private String bezeichnung;
    @Column(name = "RFC_PFLEGE_KZ")
    private String pflegeKennzeichen;
    @Column(name = "RFC_USER_ID")
    private String userId;
    @Column(name = "RFC_DATUM")
    private Date aenderungsDatum;
    @Column(name = "RFC_VERSION")
    private long version; 
    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.PERSIST, 
    private List<ReferenzWert> referenzWerte;
    @Table(name = "REFERENZWERTE")
    public static class ReferenzWert
        @Column(name = "RFW_CODE")
        private String code;
        @Column(name = "RFW_RFC_CODE")
        private String referenzCode; 
        @Column(name = "RFW_SUBRFC_CODE")
        private String subCode;
        @Column(name = "RFW_TEXT")
        private String text;
        @Column(name = "RFW_WERT")
        private long wert;
        @Column(name = "RFW_ALTERNATIV_TEXT")
        private String alternativText;
        @Column(name = "RFW_ALTERNATIV_WERT")
        private long alternativWert;
        @Column(name = "RFW_DATUM")
        private Date aenderungsDatum;
        @Column(name = "RFW_USER_ID")
        private String userId;
        @Column(name = "RFW_VERSION")
        private long version;
        private ReferenzCode parent;

While the @ManyToOne is completely correct, the @OneToMany contains for a 
RFC_CODE/RFW_RFC_CODE = "SPARTE" elements in the List that do NOT belong
to this leading to the following situation

        ReferenCode (SPARTE)
                -> referenWerte
                        0 -> ReferenzWert (5) with parent ReferenzCode 
                        1 -> ReferenzWert (8) with parent ReferenzCode 

I do not really understand what happends here. All ReferenzWerte of 
ReferenzCode SPARTE are present, BUT there are some additional ones that 
do not belong

Any help with this issue would be appreciated. I'm using Websphere 6.1 
(FeaturePack EJB3 with openJPA 1.0.3). If I do a manual query for all 
ReferenzWerte to
a certain ReferenzCode via NamedQuery, everything works as expected.

Thanks in advance,


Dr.-Ing. Heiko Kopp / Fa. GFI - iT media Consult GmbH
c/o Mercedes-Benz Bank
70469 Stuttgart

Tel.: 0711 2574-6144
Fax: 0711 2574-96144

If you are not the intended addressee, please inform us immediately that you have received
this e-mail in error, and delete it. We thank you for your cooperation.  
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message