Primary Keys...


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.


    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.

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


    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.
    at java.lang.String.<init>(
    at weblogic.utils.StackTraceUtils.throwable2StackTrace(
    at weblogic.common.T3Exception.<init>(
    at weblogic.rmi.RemoteException.<init>(
    at weblogic.rmi.ServerError.<init>(
    at weblogic.rmi.extensions.BasicServerObjectAdapter.postInvoke(
    at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(
    at weblogic.rmi.internal.BasicExecuteRequest.execute(
    at, Compiled Code)