-->
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.  [ 3 posts ] 
Author Message
 Post subject: duplicate objects
PostPosted: Thu Nov 18, 2004 12:21 pm 
Regular
Regular

Joined: Tue Oct 12, 2004 9:02 am
Posts: 66
Location: Italy
I have to check if some objects (in my preference list) are contained in the list i have.
This causes a net.sf.hibernate.NonUniqueObjectException (only if cascade=save-update, with none i have not this problm..but other problem ;)...)

So i can't have this 2 lists loaded in the same session...
I implementing the open-session-in-view pattern so all this operations have to be done with an opened session.

How to solve the problem?
thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 18, 2004 1:33 pm 
Regular
Regular

Joined: Tue Jan 27, 2004 12:22 pm
Posts: 103
Agori,

please supply some additional data. See the link in the red box above (when posting) what to supply.

_________________
Dencel
- The sun has never seen a shadow -


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 18, 2004 3:54 pm 
Regular
Regular

Joined: Tue Oct 12, 2004 9:02 am
Posts: 66
Location: Italy
Sorry,

Something like that throws that exception in some situations:

Set preferred = utente.getNormativeSegnate();
for (int i = 0; i < results.size(); ++i) {
boolean flag = false;
for (Iterator prefs = preferred.iterator(); prefs.hasNext();) {
Preferito p = (Preferito) prefs.next();
Normativa normativa = (Normativa) results.get(i);
if (p.getNormativa().getId().equals(normativa.getId())) {
signed.add("true");
flag = true;
break;
}
}
if (!flag) {
signed.add("false");
}
}

you can see that "Preferito p" contains a field of type Normativa. So when I do p.getNormativa().... i am loading another normativa, that sometimes is already in the session (in the "results list" of Normativa objects).


I don't know how to obtain the comparison in the code without going in to this exception!


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

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.