You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by David Le Strat <dl...@yahoo.com> on 2004/01/18 21:27:59 UTC

Double Insert with OJB RC5 with M-N mapping.

Hi there,

I am using OJB RC5 with an M-N mapping and am having
an issue with records being inserted twice (I am using
HSQL for development).  Here is the scenario:

I have a Principal that has Permissions where

Principal N ... M Permission

I add a new Principal with a collection of
Permissions.  In my initial test, there is only 1
Permission in my collection.  When running that
scenario, the Permission INSERT statement is executed
twice.

/*C1*/SET AUTOCOMMIT FALSE
INSERT INTO SECURITY_PRINCIPAL
VALUES(182,'org.apache.jetspeed.security.impl.UserPrincipalImpl','/user/testpermission','2004-01-18
14:41:22.956','2004-01-18 14:41:22.956')
INSERT INTO SECURITY_PERMISSION
VALUES(183,'org.apache.jetspeed.security.PortletPermission','testportlet','view,
edit, delete, minimize','2004-01-18
14:41:22.956','2004-01-18 14:41:22.956')
INSERT INTO SECURITY_PRINCIPAL_PERMISSION
VALUES(182,183)
INSERT INTO SECURITY_PERMISSION
VALUES(183,'org.apache.jetspeed.security.PortletPermission','testportlet','view,
edit, delete, minimize','2004-01-18
14:41:22.956','2004-01-18 14:41:22.956')
COMMIT
SET AUTOCOMMIT TRUE

I had an integrity constraint on SECURITY_PERMISSION,
but removed it to confirm that the insert was executed
twice.

I enclosed schema, repository definition, some code
sample and the logs of what's happening.

Looking at the logs, I can see 2:
[main] DEBUG
org.apache.ojb.broker.accesslayer.JdbcAccessImpl -
executeInsert :
org.apache.jetspeed.security.om.impl.PermissionImpl

I would appreciate some advice on how to work around
this behavior.

Regards,

David Le Strat.

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

Re: Double Insert with OJB RC5 with M-N mapping.

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi david,

there's a testcase in class MtoNTest for the scenario you describe. this 
testcase does not produce duplicate inserts (when using the latest from cvs)

hth
jakob

David Le Strat wrote:

> Hello Jakob,
> 
> I just tried with the latest OJB build and M-N inserts
> still create duplicate records.
> 
> Regards,
> 
> David.
> 
> --- Jakob Braeuchi <jb...@gmx.ch> wrote:
> 
>>hi david,
>>
>>does this problem still exist in the latest from cvs
>>? imo i've commited a fix 
>>for it.
>>
>>jakob
>>
>>David Le Strat wrote:
>>
>>>For info, I found a work around to my problem.  I
>>>first create the Permission I wanted to add before
>>>creating the Principal.
>>>
>>>The described problem is still an issue.
>>>
>>>Regards,
>>>
>>>David Le Strat.
>>>
>>>--- David Le Strat <dl...@yahoo.com> wrote:
>>>
>>>
>>>>Hi there,
>>>>
>>>>I am using OJB RC5 with an M-N mapping and am
>>
>>having
>>
>>>>an issue with records being inserted twice (I am
>>>>using
>>>>HSQL for development).  Here is the scenario:
>>>>
>>>>I have a Principal that has Permissions where
>>>>
>>>>Principal N ... M Permission
>>>>
>>>>I add a new Principal with a collection of
>>>>Permissions.  In my initial test, there is only 1
>>>>Permission in my collection.  When running that
>>>>scenario, the Permission INSERT statement is
>>>>executed
>>>>twice.
>>>>
>>>>/*C1*/SET AUTOCOMMIT FALSE
>>>>INSERT INTO SECURITY_PRINCIPAL
>>>>
>>>
>>>
> VALUES(182,'org.apache.jetspeed.security.impl.UserPrincipalImpl','/user/testpermission','2004-01-18
> 
>>>>14:41:22.956','2004-01-18 14:41:22.956')
>>>>INSERT INTO SECURITY_PERMISSION
>>>>
>>>
>>>
> VALUES(183,'org.apache.jetspeed.security.PortletPermission','testportlet','view,
> 
>>>>edit, delete, minimize','2004-01-18
>>>>14:41:22.956','2004-01-18 14:41:22.956')
>>>>INSERT INTO SECURITY_PRINCIPAL_PERMISSION
>>>>VALUES(182,183)
>>>>INSERT INTO SECURITY_PERMISSION
>>>>
>>>
>>>
> VALUES(183,'org.apache.jetspeed.security.PortletPermission','testportlet','view,
> 
>>>>edit, delete, minimize','2004-01-18
>>>>14:41:22.956','2004-01-18 14:41:22.956')
>>>>COMMIT
>>>>SET AUTOCOMMIT TRUE
>>>>
>>>>I had an integrity constraint on
>>>>SECURITY_PERMISSION,
>>>>but removed it to confirm that the insert was
>>>>executed
>>>>twice.
>>>>
>>>>I enclosed schema, repository definition, some
>>
>>code
>>
>>>>sample and the logs of what's happening.
>>>>
>>>>Looking at the logs, I can see 2:
>>>>[main] DEBUG
>>>>org.apache.ojb.broker.accesslayer.JdbcAccessImpl -
>>>>executeInsert :
>>
>>>org.apache.jetspeed.security.om.impl.PermissionImpl
>>>
>>>>I would appreciate some advice on how to work
>>
>>around
>>
>>>>this behavior.
>>>>
>>>>Regards,
>>>>
>>>>David Le Strat.
>>>>
>>>>__________________________________
>>>>Do you Yahoo!?
>>>>Yahoo! Hotjobs: Enter the "Signing Bonus"
>>>>Sweepstakes
>>>>http://hotjobs.sweepstakes.yahoo.com/signingbonus
>>>
>>>
>>>>ATTACHMENT part 2 application/x-zip-compressed
>>>
>>>name=M-NIssue.zip
>>>
>>>
>>
> ---------------------------------------------------------------------
> 
>>>>To unsubscribe, e-mail:
>>>>ojb-dev-unsubscribe@db.apache.org
>>>>For additional commands, e-mail:
>>>
>>>ojb-dev-help@db.apache.org
>>>
>>>
>>>__________________________________
>>>Do you Yahoo!?
>>>Yahoo! Hotjobs: Enter the "Signing Bonus"
>>
>>Sweepstakes
>>
>>>http://hotjobs.sweepstakes.yahoo.com/signingbonus
>>>
>>>
>>
> ---------------------------------------------------------------------
> 
>>>To unsubscribe, e-mail:
>>
>>ojb-dev-unsubscribe@db.apache.org
>>
>>>For additional commands, e-mail:
>>
>>ojb-dev-help@db.apache.org
>>
>>>
>>
> ---------------------------------------------------------------------
> 
>>To unsubscribe, e-mail:
>>ojb-dev-unsubscribe@db.apache.org
>>For additional commands, e-mail:
>>ojb-dev-help@db.apache.org
>>
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
> http://hotjobs.sweepstakes.yahoo.com/signingbonus
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: Double Insert with OJB RC5 with M-N mapping.

Posted by David Le Strat <dl...@yahoo.com>.
Hello Jakob,

I just tried with the latest OJB build and M-N inserts
still create duplicate records.

Regards,

David.

--- Jakob Braeuchi <jb...@gmx.ch> wrote:
> hi david,
> 
> does this problem still exist in the latest from cvs
> ? imo i've commited a fix 
> for it.
> 
> jakob
> 
> David Le Strat wrote:
> > For info, I found a work around to my problem.  I
> > first create the Permission I wanted to add before
> > creating the Principal.
> > 
> > The described problem is still an issue.
> > 
> > Regards,
> > 
> > David Le Strat.
> > 
> > --- David Le Strat <dl...@yahoo.com> wrote:
> > 
> >>Hi there,
> >>
> >>I am using OJB RC5 with an M-N mapping and am
> having
> >>an issue with records being inserted twice (I am
> >>using
> >>HSQL for development).  Here is the scenario:
> >>
> >>I have a Principal that has Permissions where
> >>
> >>Principal N ... M Permission
> >>
> >>I add a new Principal with a collection of
> >>Permissions.  In my initial test, there is only 1
> >>Permission in my collection.  When running that
> >>scenario, the Permission INSERT statement is
> >>executed
> >>twice.
> >>
> >>/*C1*/SET AUTOCOMMIT FALSE
> >>INSERT INTO SECURITY_PRINCIPAL
> >>
> > 
> >
>
VALUES(182,'org.apache.jetspeed.security.impl.UserPrincipalImpl','/user/testpermission','2004-01-18
> > 
> >>14:41:22.956','2004-01-18 14:41:22.956')
> >>INSERT INTO SECURITY_PERMISSION
> >>
> > 
> >
>
VALUES(183,'org.apache.jetspeed.security.PortletPermission','testportlet','view,
> > 
> >>edit, delete, minimize','2004-01-18
> >>14:41:22.956','2004-01-18 14:41:22.956')
> >>INSERT INTO SECURITY_PRINCIPAL_PERMISSION
> >>VALUES(182,183)
> >>INSERT INTO SECURITY_PERMISSION
> >>
> > 
> >
>
VALUES(183,'org.apache.jetspeed.security.PortletPermission','testportlet','view,
> > 
> >>edit, delete, minimize','2004-01-18
> >>14:41:22.956','2004-01-18 14:41:22.956')
> >>COMMIT
> >>SET AUTOCOMMIT TRUE
> >>
> >>I had an integrity constraint on
> >>SECURITY_PERMISSION,
> >>but removed it to confirm that the insert was
> >>executed
> >>twice.
> >>
> >>I enclosed schema, repository definition, some
> code
> >>sample and the logs of what's happening.
> >>
> >>Looking at the logs, I can see 2:
> >>[main] DEBUG
> >>org.apache.ojb.broker.accesslayer.JdbcAccessImpl -
> >>executeInsert :
>
>>org.apache.jetspeed.security.om.impl.PermissionImpl
> >>
> >>I would appreciate some advice on how to work
> around
> >>this behavior.
> >>
> >>Regards,
> >>
> >>David Le Strat.
> >>
> >>__________________________________
> >>Do you Yahoo!?
> >>Yahoo! Hotjobs: Enter the "Signing Bonus"
> >>Sweepstakes
> >>http://hotjobs.sweepstakes.yahoo.com/signingbonus
> > 
> > 
> >>ATTACHMENT part 2 application/x-zip-compressed
> > 
> > name=M-NIssue.zip
> > 
> >
>
---------------------------------------------------------------------
> > 
> >>To unsubscribe, e-mail:
> >>ojb-dev-unsubscribe@db.apache.org
> >>For additional commands, e-mail:
> > 
> > ojb-dev-help@db.apache.org
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Hotjobs: Enter the "Signing Bonus"
> Sweepstakes
> > http://hotjobs.sweepstakes.yahoo.com/signingbonus
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> ojb-dev-unsubscribe@db.apache.org
> > For additional commands, e-mail:
> ojb-dev-help@db.apache.org
> > 
> > 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail:
> ojb-dev-help@db.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: Double Insert with OJB RC5 with M-N mapping.

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi david,

does this problem still exist in the latest from cvs ? imo i've commited a fix 
for it.

jakob

David Le Strat wrote:
> For info, I found a work around to my problem.  I
> first create the Permission I wanted to add before
> creating the Principal.
> 
> The described problem is still an issue.
> 
> Regards,
> 
> David Le Strat.
> 
> --- David Le Strat <dl...@yahoo.com> wrote:
> 
>>Hi there,
>>
>>I am using OJB RC5 with an M-N mapping and am having
>>an issue with records being inserted twice (I am
>>using
>>HSQL for development).  Here is the scenario:
>>
>>I have a Principal that has Permissions where
>>
>>Principal N ... M Permission
>>
>>I add a new Principal with a collection of
>>Permissions.  In my initial test, there is only 1
>>Permission in my collection.  When running that
>>scenario, the Permission INSERT statement is
>>executed
>>twice.
>>
>>/*C1*/SET AUTOCOMMIT FALSE
>>INSERT INTO SECURITY_PRINCIPAL
>>
> 
> VALUES(182,'org.apache.jetspeed.security.impl.UserPrincipalImpl','/user/testpermission','2004-01-18
> 
>>14:41:22.956','2004-01-18 14:41:22.956')
>>INSERT INTO SECURITY_PERMISSION
>>
> 
> VALUES(183,'org.apache.jetspeed.security.PortletPermission','testportlet','view,
> 
>>edit, delete, minimize','2004-01-18
>>14:41:22.956','2004-01-18 14:41:22.956')
>>INSERT INTO SECURITY_PRINCIPAL_PERMISSION
>>VALUES(182,183)
>>INSERT INTO SECURITY_PERMISSION
>>
> 
> VALUES(183,'org.apache.jetspeed.security.PortletPermission','testportlet','view,
> 
>>edit, delete, minimize','2004-01-18
>>14:41:22.956','2004-01-18 14:41:22.956')
>>COMMIT
>>SET AUTOCOMMIT TRUE
>>
>>I had an integrity constraint on
>>SECURITY_PERMISSION,
>>but removed it to confirm that the insert was
>>executed
>>twice.
>>
>>I enclosed schema, repository definition, some code
>>sample and the logs of what's happening.
>>
>>Looking at the logs, I can see 2:
>>[main] DEBUG
>>org.apache.ojb.broker.accesslayer.JdbcAccessImpl -
>>executeInsert :
>>org.apache.jetspeed.security.om.impl.PermissionImpl
>>
>>I would appreciate some advice on how to work around
>>this behavior.
>>
>>Regards,
>>
>>David Le Strat.
>>
>>__________________________________
>>Do you Yahoo!?
>>Yahoo! Hotjobs: Enter the "Signing Bonus"
>>Sweepstakes
>>http://hotjobs.sweepstakes.yahoo.com/signingbonus
> 
> 
>>ATTACHMENT part 2 application/x-zip-compressed
> 
> name=M-NIssue.zip
> 
> ---------------------------------------------------------------------
> 
>>To unsubscribe, e-mail:
>>ojb-dev-unsubscribe@db.apache.org
>>For additional commands, e-mail:
> 
> ojb-dev-help@db.apache.org
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
> http://hotjobs.sweepstakes.yahoo.com/signingbonus
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: Double Insert with OJB RC5 with M-N mapping.

Posted by David Le Strat <dl...@yahoo.com>.
For info, I found a work around to my problem.  I
first create the Permission I wanted to add before
creating the Principal.

The described problem is still an issue.

Regards,

David Le Strat.

--- David Le Strat <dl...@yahoo.com> wrote:
> Hi there,
> 
> I am using OJB RC5 with an M-N mapping and am having
> an issue with records being inserted twice (I am
> using
> HSQL for development).  Here is the scenario:
> 
> I have a Principal that has Permissions where
> 
> Principal N ... M Permission
> 
> I add a new Principal with a collection of
> Permissions.  In my initial test, there is only 1
> Permission in my collection.  When running that
> scenario, the Permission INSERT statement is
> executed
> twice.
> 
> /*C1*/SET AUTOCOMMIT FALSE
> INSERT INTO SECURITY_PRINCIPAL
>
VALUES(182,'org.apache.jetspeed.security.impl.UserPrincipalImpl','/user/testpermission','2004-01-18
> 14:41:22.956','2004-01-18 14:41:22.956')
> INSERT INTO SECURITY_PERMISSION
>
VALUES(183,'org.apache.jetspeed.security.PortletPermission','testportlet','view,
> edit, delete, minimize','2004-01-18
> 14:41:22.956','2004-01-18 14:41:22.956')
> INSERT INTO SECURITY_PRINCIPAL_PERMISSION
> VALUES(182,183)
> INSERT INTO SECURITY_PERMISSION
>
VALUES(183,'org.apache.jetspeed.security.PortletPermission','testportlet','view,
> edit, delete, minimize','2004-01-18
> 14:41:22.956','2004-01-18 14:41:22.956')
> COMMIT
> SET AUTOCOMMIT TRUE
> 
> I had an integrity constraint on
> SECURITY_PERMISSION,
> but removed it to confirm that the insert was
> executed
> twice.
> 
> I enclosed schema, repository definition, some code
> sample and the logs of what's happening.
> 
> Looking at the logs, I can see 2:
> [main] DEBUG
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl -
> executeInsert :
> org.apache.jetspeed.security.om.impl.PermissionImpl
> 
> I would appreciate some advice on how to work around
> this behavior.
> 
> Regards,
> 
> David Le Strat.
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Hotjobs: Enter the "Signing Bonus"
> Sweepstakes
> http://hotjobs.sweepstakes.yahoo.com/signingbonus

> ATTACHMENT part 2 application/x-zip-compressed
name=M-NIssue.zip
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail:
ojb-dev-help@db.apache.org


__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org