Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DuplicateKeyException, but the id is not in the database!

5 views
Skip to first unread message

Russell Castagnaro

unread,
Nov 11, 2002, 7:29:08 PM11/11/02
to
Aloha!
I have a stateful session bean that is trying to create about 5 CMP Entity beans.
I'm using WLS 7.01 on windows 2000. The beans are using 5.1 persistence.

The ejbCreate method of the bean is called, a sequence the correct sequence is determined, then the exception gets thrown.
Any ideas? The pk is NOT in the database!

javax.ejb.DuplicateKeyException: Bean with primary key: '8530' already exists.
at com.get2hawaii.contact.EmailEJB_13xh18__WebLogic_CMP_RDBMS.__WL_create(EmailEJB_13xh18__WebLogic_CMP_RDBMS.java:881)
at com.get2hawaii.contact.EmailEJB_13xh18__WebLogic_CMP_RDBMS.ejbCreate(EmailEJB_13xh18__WebLogic_CMP_RDBMS.java:771)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at weblogic.ejb20.manager.ExclusiveEntityManager.create(ExclusiveEntityManager.java:731)
at weblogic.ejb20.manager.ExclusiveEntityManager.remoteCreate(ExclusiveEntityManager.java:702)
at weblogic.ejb20.internal.EntityEJBHome.create(EntityEJBHome.java:250)
at com.get2hawaii.contact.EmailEJB_13xh18_HomeImpl.create(EmailEJB_13xh18_HomeImpl.java:122)
at com.get2hawaii.experience.UserExperienceEJB.setTravelerInfo(UserExperienceEJB.java:1392)

Thanks!

Ahmed

unread,
Nov 13, 2002, 2:52:41 AM11/13/02
to
Hi Russell,

I think I've encountered a similar problem with the same version of
Weblogic that you're using ie. 7.0.1.0 on Win2k.

Are you perhaps delegating method invocations from one version of the
ejbCreate() method in the bean to another ejbCreate() method in the
same bean?

If the answer to the above question is YES, then I have found that
what this does is attempt creating the same database row twice, hence
the javax.ejb.DuplicateKeyException. Simply duplicate the necessary
code in the ejbCreate() methods, and all should be well (Probably not
good design though?)

Try turning on verbose mode for the weblogic server to check the
process it follows, or put JPDA hooks into the generated Bean
implementation code to see what is going on.

I have no idea why this works like this though... probably another
feature :-)

Later
Ahmed

Russell Castagnaro <rus...@get2hawaii.com> wrote in message news:<3dd04b54$1...@newsgroups.bea.com>...

0 new messages