Hi Markus, what version of Castor are you using? I know I've gone
through and tried to clarify the debug details, but it appears I
missed this particular message. (not very helpful is it?).

BUT, anyways, remove that last (db.update(ldbp_User);) and see if that
helps. I think, somehow, when you load up the particular Role Castor
is also loading the User. If thats the case it knows that it will
update everything with out needing the last db.update() and also will
throw the error you have. Try it, and see what happens.

-Nick


On Fri, 10 Dec 2004 08:03:24 +0100, Markus Sell
<[EMAIL PROTECTED]> wrote:
> Hi,
> 
> in the second transaction I'm setting some user attributes
> 
> .
> ldbp_User.setConfiguration("asjalslka");
> .
> 
> I'm not loading the user in the second transaction. The Roles have also
> a Vector of Users.
> 
> I need the update statement in the second transaction, so that the
> setConfiguration takes effect, or?
> 
> thanks,
> markus
> 
> 
> 
> -----Original Message-----
> From: Nick Stuart
> To: [EMAIL PROTECTED]
> Sent: 08.12.04 19:02
> Subject: Re: [castor-dev]
> org.exolab.castor.jdo.DuplicateIdentityException
> 
> Whats the ... in your second transaction? Do you load he user in there
> or use the one from up above? Also, does role have a Vector of users
> in it? if so you could loading the user already when you go to load
> the roles. Trying taking out the db.update and see if that works.
> 
> -Nick
> 
> On Tue, 7 Dec 2004 23:21:43 +0100, Markus Sell
> <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > i have the following scenario:
> > 1) a user is working for different customers and has different roles.
> > 2) 3 objects exists: User, Customer and Roles.
> > User:
> > public class user implements Persistent, TimeStampable {
> >     Vector cvct_Roles;
> >     Vector cvct_Customer;
> >     ...
> >     public Vector getRoles() {
> >         return cvct_Roles;
> >     }
> >
> >     public void setRoles(Vector roles) {
> >         cvct_Roles = roles;
> >     }
> >
> >     public void addRoles(Roles role) {
> >         if (!cvct_Roles.contains(role)) {
> >             cvct_Roles.addElement(role);
> >             role.addUser(this);
> >         }
> >     }
> >
> >     ...
> > }
> > The Role object class look simular.
> >
> > 3) relationships: user - customer (n:m) in table user2customer, user -
> roles (n:m) in table user2role
> > 4) in the mapping file i'm using the "many-table" statement
> >
> > If I create a new User with new Customer or Role assignments it works
> perfectly. If I try to update an existing User by adding a new Role, I
> get the exception:
> > org.exolab.castor.jdo.DuplicateIdentityException: update object which
> is already in the transaction
> >         at
> org.exolab.castor.persist.TransactionContext.markUpdate(TransactionConte
> xt.java:995)
> >         at
> org.exolab.castor.persist.TransactionContext.update(TransactionContext.j
> ava:1074)
> >         at
> org.exolab.castor.jdo.engine.DatabaseImpl.update(DatabaseImpl.java:378)
> >
> > I'm using long transaction to do the update the user object.
> >
> > ..
> > db.begin();
> > User ldbp_User = (User)db.load(User.class, userkey);
> > db.commit();
> > ..
> > db.begin();
> > ..
> > for (int lint_Index = 0; lint_Index < roles.size(); lint_Index++) {
> >   Role ldbp_Role = (Role)db.load(Rol.class,
> ((Integer)roles.getlint_Index)).intValue());
> >   ldbp_User.addRoles(ldbp_Role);
> > }
> > db.update(ldbp_User);
> > db.commit();
> >
> > Any ideas? Do I have to load the Role Object in the first Transaction?
> Use Autostore?
> >
> > thanks,
> > markus
> >
> >
> > -----------------------------------------------------------
> > If you wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of:
> >         unsubscribe castor-dev
> >
> >
> >
> 
> 
> -----------------------------------------------------------
> 
> 
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev
> 
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev
> 
> 
>



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to