Hello Panu,
both cases should work. Could you provide a testcase for the problem?
I can't reproduce it.
alex
Monday, January 13, 2003, 2:50:06 PM, you wrote:
PH> Hi all!
PH> Can't you modify a N-1 CMP relation by assigning the 1-end
PH> to the single value field on the N-end? At least it
PH> seems to create some problems, namely the N-side object
PH> is found two times in the 1-side Collection if accessed
PH> inside the same transaction that the relation was set up in.
PH> Suppose we have two CMP entity beans: First and Second, having
PH> a 1-N relation so that we have:
PH> Collection FirstLocal.get/setSeconds()
PH> FirstLocal SecondLocal.get/setFirst()
PH> Now, I'm doing this:
PH> transaction.begin();
PH> first = firstLocalHome.create();
PH> second = secondLocalHome.create();
PH> second.setFirst(first);
PH> hits = first.getSeconds();
PH> i = hits.iterator();
PH> while(i.hasNext()) {
PH> SecondLocal temp = (SecondLocal)i.next();
PH> debugOutput(temp.getId());
PH> }
PH> transaction.commit();
PH> ...and I get the "second" object listed twice.
PH> This works:
PH> transaction.begin();
PH> first = firstLocalHome.create();
PH> second = secondLocalHome.create();
PH> second.setFirst(first);
PH> // starting a new transaction
PH> transaction.commit();
PH> transaction.begin();
PH> hits = first.getSeconds();
PH> i = hits.iterator();
PH> while(i.hasNext()) {
PH> SecondLocal temp = (SecondLocal)i.next();
PH> debugOutput(temp.getId());
PH> }
PH> transaction.commit();
PH> And so does this:
PH> transaction.begin();
PH> first = firstLocalHome.create();
PH> second = secondLocalHome.create();
PH> // setting up relation on 1-side
PH> first.getSeconds().add(second);
PH> hits = first.getSeconds();
PH> i = hits.iterator();
PH> while(i.hasNext()) {
PH> SecondLocal temp = (SecondLocal)i.next();
PH> debugOutput(temp.getId());
PH> }
PH> transaction.commit();
PH> The strange thing is, that EJB 2.0 specification
PH> doesn't seem to say anything about this N-side
PH> setting issue that I'm doing. Or is it just that
PH> I didn't find it?
PH> Panu
-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user