Discussions

EJB design: Primary Keys...

  1. Primary Keys... (2 messages)

    This question might have been asked, if there is an answer to it somewhere, please point me to it:
    First of all, is it possible to deploy an EJB (entity CMP/BMP) with a Primary key other than java.lang.String.
    The other one is: according to the spec we can only have one primary key field per entity bean (please correct me if I am wrong). What if I want to support multiple PKs (more than one field in a PK class). Would it work... How.
    Your help is appreciated.

    -Omar

    Threaded Messages (2)

  2. Primary Keys...[ Go to top ]

    It is possible to deploy an entity bean with the primary key class other than java.lang.String. You can write a serializable class and use it as the primary key.

    There are several requirements on the primary key class.
    First, it must be serializable. Second, all the fields in the primary key class must be public.

    Refer to Sun J2EE developer guide. There are examples regarding to write a primary key class.

    Fengliang
  3. Primary Keys...[ Go to top ]

    hi,

    I'm using weblogic 5.1. I have created entity bean wiht java.lang.String as PK. It worked fine and i have converted the Primarykey to a Class according to spec. I checkd for 1.1 compliance and deployed my bean every thing looked ok. I also made sure that i'm not using primary key field in the .xml, and defined the proper primarykey class.When i make a remote call to my bean i get the following error. I tried it many time but no luck.

    What i'm curious is now is there any problem in setting up weblogic on my machine or is the problem lies with the code.

    I would greatly appreciate any help in this regard. Can anybody share a code with composite key. i can also be contacted at sriram_m at hotmail dot com


    Fri Aug 25 09:31:21 EDT 2000:<I> <WebLogicServer> WebLogic Server started
    Fri Aug 25 09:36:06 EDT 2000:<I> <NT Performance Pack> Allocating: '2' NT reader threads
    Fri Aug 25 09:36:07 EDT 2000:<D> <JVMSocketHTTPServer> opened sockID: '0'
    Fri Aug 25 09:36:09 EDT 2000:<I> <ServletContext-General> classes: init
    Fri Aug 25 09:36:54 EDT 2000:<E> <Kernel> ExecuteRequest failed.
    java.lang.OutOfMemoryError
    at java.lang.String.<init>(String.java:434)
    at java.io.ByteArrayOutputStream.toString(ByteArrayOutputStream.java:176)
    at weblogic.utils.StackTraceUtils.throwable2StackTrace(StackTraceUtils.java:22)
    at weblogic.common.T3Exception.<init>(T3Exception.java:50)
    at weblogic.rmi.RemoteException.<init>(RemoteException.java:41)
    at weblogic.rmi.ServerError.<init>(ServerError.java:18)
    at weblogic.rmi.extensions.BasicServerObjectAdapter.postInvoke(BasicServerObjectAdapter.java:389)
    at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandler.java:73)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:15)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)