|
Home > Archive > WebSphere Commerce suite > January 2004 > CatalogGroupAttributeAccessBean duplicate keys
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
CatalogGroupAttributeAccessBean duplicate keys
|
|
| Aymeric 2004-01-19, 2:48 pm |
| Hi,
I' m trying to add records in the CATGRPATTR table using the
CatalogGroupAttributeAccessBean (adding several attributes to the same
catgroup).
I have code like this one assuming nCatgroupId and langId are valid numbers
for my database:
////////////
CatalogGroupAttributeAccessBean newAttribute = new
CatalogGroupAttributeAccessBean(nCatgrou
pId, langId);
newAttribute.setName("name3");
newAttribute.setDescription("desc3");
newAttribute.commitCopyHelper();
/////////
If I put this page in a jsp, I can run it as many times as I want and the
table gets updated (as long as I change setName("name3") to a different
value every time (unique key) )
But if I try to make 2 inserts in the same page, it fails and gives me a
duplicate key exception on the new
CatalogGroupAttributeAccessBean(nCatgrou
pId, langId) the second time :
////////////
CatalogGroupAttributeAccessBean newAttribute = new
CatalogGroupAttributeAccessBean(nCatgrou
pId, langId);
newAttribute.setName("name3");
newAttribute.setDescription("desc3");
newAttribute.commitCopyHelper();
CatalogGroupAttributeAccessBean newAttribute2 = new
CatalogGroupAttributeAccessBean(nCatgrou
pId, langId);
newAttribute2.setName("name4");
newAttribute2.setDescription("desc4");
newAttribute2.commitCopyHelper();
////
I'm very confused about that, is there some kind of locks going on? Am I
doing something stupid and would there be another way to do it?
Thanks for any tip.
AB
| |
| Aymeric 2004-01-19, 2:48 pm |
| I forgot to tell:
I'm running WC Express 5.5 Developper Edition
"Aymeric" <abondon@hotmail.com> a écrit dans le message de news:
bn6dvg$1fu8$1@news.boulder.ibm.com...quote:
> Hi,
> I' m trying to add records in the CATGRPATTR table using the
> CatalogGroupAttributeAccessBean (adding several attributes to the same
> catgroup).
>
> I have code like this one assuming nCatgroupId and langId are valid
numbersquote:
> for my database:
> ////////////
> CatalogGroupAttributeAccessBean newAttribute = new
> CatalogGroupAttributeAccessBean(nCatgrou
pId, langId);
> newAttribute.setName("name3");
> newAttribute.setDescription("desc3");
> newAttribute.commitCopyHelper();
> /////////
> If I put this page in a jsp, I can run it as many times as I want and the
> table gets updated (as long as I change setName("name3") to a different
> value every time (unique key) )
> But if I try to make 2 inserts in the same page, it fails and gives me a
> duplicate key exception on the new
> CatalogGroupAttributeAccessBean(nCatgrou
pId, langId) the second time :
>
>
> ////////////
> CatalogGroupAttributeAccessBean newAttribute = new
> CatalogGroupAttributeAccessBean(nCatgrou
pId, langId);
> newAttribute.setName("name3");
> newAttribute.setDescription("desc3");
> newAttribute.commitCopyHelper();
>
> CatalogGroupAttributeAccessBean newAttribute2 = new
> CatalogGroupAttributeAccessBean(nCatgrou
pId, langId);
> newAttribute2.setName("name4");
> newAttribute2.setDescription("desc4");
> newAttribute2.commitCopyHelper();
> ////
> I'm very confused about that, is there some kind of locks going on? Am I
> doing something stupid and would there be another way to do it?
> Thanks for any tip.
>
> AB
>
>
|
|
|
|
|