-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: reassociated object has irty collection reference (or array)
PostPosted: Mon Mar 19, 2007 3:01 am 
Newbie

Joined: Wed Mar 14, 2007 2:21 am
Posts: 5
I 'm trying to save a Supplier object which has certain # of fields of type List. On saving, I get this error:

org.hibernate.HibernateException: reassociated object has dirty collection reference (or an array)

One of the helps on forum on net suggested to use cascade lock. So, I placed

@Cascade(org.hibernate.annotations.CascadeType.LOCK)

above all the getters of type List. But, this didn't help. Could anyone plz help me ?

Besides, most of the properties of the object have been provided with both java.persistence and hibernate annotations as shown below:

Code:
@ManyToMany(targetEntity = Color.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY)
    @JoinTable(name = "SUP_SUPPLIER_PERS_COLOR", uniqueConstraints = @UniqueConstraint(columnNames = { "SUPPLIER_ID",
            "PERS_COLOR_ID" }), joinColumns = @JoinColumn(name = "SUPPLIER_ID"), inverseJoinColumns = @JoinColumn(name = "PERS_COLOR_ID"))
    @Cascade(org.hibernate.annotations.CascadeType.ALL)
    @OrderBy("description")
    public List<Color> getColors() {
        if (null == colors) {
            colors = new ArrayList<Color>();
        }
        return colors;
    }


Do I need to add both annotations ?

[/b]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.