I have a queer problem . I have an CMP Entity Bean which inserts (Person) details and the Primary Key is a sequence triggered by the database .

My Client program works fine and does inserts rows but fails in certain predictable cases with Duplicate Key Exception

when the previous bean instance is not passivated (I hope my inference is correct ) .

This happens when I run my client Program repeatedly . My primary key is an integer. I have a PK class and so a pk (personid )instance variable in the fields

Below is the server side log . where I have 2 successful inserts and a Duplicate Key exception .

Creating connection to localhost/127.0.0

. 1 -1011540616482516961

Wed Apr 19 13:12:13 PDT 2000:<I> <RJVM> Closing connection to localhost/127.0.0.

1 -2433596992897452460

Wed Apr 19 13:12:13 PDT 2000:<I> <PosixSocketMux> EOF on socket type HTTP

PersonBean.ejbCreate( id = 16790771, PK = , )

PersonBean.ejbPostCreate (16790771, PK = 0)

<--- Person id is = 0 --->

setModified(): 16790771, PK = 0: saving not required

isModified(): isDirty = false

Wed Apr 19 13:12:13 PDT 2000:<I> <PosixSocketMux> EOF on socket type t3

PersonBean.ejbPassivate (16790771, PK = 0) / * instance with id 16790771 passivated son next insert works fine */

 

Wed Apr 19 13:12:20 PDT 2000:<I> <RJVM> Creating connection to localhost/127.0.0

. 1 6046260702735035077

PersonBean.ejbCreate( id = 16790771, PK = , )

PersonBean.ejbPostCreate (16790771, PK = 0)

<--- Person id is = 0 --->

setModified(): 16790771, PK = 0: saving not required

isModified(): isDirty = false

Wed Apr 19 13:12:21 PDT 2000:<I> <PosixSocketMux> EOF on socket type t3

Wed Apr 19 13:12:23 PDT 2000:<I> <RJVM> Closing connection to localhost/127.0.0.

1 -1011540616482516961

Wed Apr 19 13:12:23 PDT 2000:<I> <PosixSocketMux> EOF on socket type HTTP

Wed Apr 19 13:12:27 PDT 2000:<I> <RJVM> Creating connection to localhost/127.0.0

.1 3563672288038182443

PersonBean.setEntityContext (26257141, PK = nullctx) /* new bean instance 26257141 ,16790771 not pasivated */

(hence it fails with duplicated key exception */

 

setModified(): 26257141, PK = null: requires saving

PersonBean.ejbCreate( id = 26257141, PK = , )

Wed Apr 19 13:12:28 PDT 2000:<I> <EJB> Transaction: '956166252381_32' rolled bac

k due to EJB exception:

javax.ejb.DuplicateKeyException: Bean with primary key: '0' already exists in ho

me: 'Person.PersonHome'

at java.lang.Throwable.fillInStackTrace(Native Method)

 

at java.lang.Throwable.fillInStackTrace(Compiled Code)

at java.lang.Throwable.<init>(Compiled Code)

at java.lang.Exception.<init>(Compiled Code)

at javax.ejb.CreateException.<init>(Compiled Code)

at javax.ejb.DuplicateKeyException.<init>(Compiled Code)

at weblogic.ejb.internal.StatefulEJBObject.postCreate(Compiled Code)

at com.ftpoint.portal.Person.PersonBeanEOImpl.create(Compiled Code)

at com.ftpoint.portal.Person.PersonBeanHomeImpl.create(Compiled Code)

at com.ftpoint.portal.Person.PersonBeanHomeImpl_WLSkel.invoke(Compiled C

ode)

at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(Compiled Code

)

at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(Compiled Co

de)

at weblogic.rmi.extensions.BasicRequestDispatcher$BasicExecuteRequest.ex

ecute(Compiled Code)

at weblogic.t3.srvr.ExecuteThread.run(Compiled Code)

Wed Apr 19 13:12:28 PDT 2000:<I> <PosixSocketMux> EOF on socket type t3

Wed Apr 19 13:12:31 PDT 2000:<I> <RJVM> Closing connection to localhost/127.0.0.

 

1 6046260702735035077

Wed Apr 19 13:12:31 PDT 2000:<I> <PosixSocketMux> EOF on socket type HTTP

PersonBean.ejbPassivate (16790771, PK = 0)

I would like any input regarding this . I am not sure my inference is the correct reasoning behind this .

Thanks

Lakshmi Anantharaman

 

 

Reply via email to