Why do we need a primary key class?

i found a sample ejb, which contains a class only used to store the primary key. is it necessary? why? i guess it's for security issue, anybody can help me to clarify? thanks in advance!

A primary key class is used next to an entity bean. It's used to represent the primary key of the table on which the entity bean is mapped.
When the primary key of the table is only one column, you don't need to implement a primary key class. You can then define java.lang.Integer or java.lang.String or another build in Java object in you deployment descriptor.

Similar Messages

  • Primary Key Class

    Hi there,
    In an entity bean, why do we need a primary key class? I read from some book that an entity bean can work all right without it. Is it true?
    Regards

    Hi,
    In cases of Primary Keys defined as Strings, the creation of Primary Key class can be ignored by the bean provider/developer. However the primary key must be generated in the program either in the setprimarykey() defined in class implementing the EntityBean interface.
    The ejb-jar.xml can have the entry as <prim-key-class>java.lang.String</prim-key-class> in such cases of both CMP and BMP EB.
    As long as you generate the Primary Key and pass it in the various callback methods like ejbFindByPrimaryKey, ejbCreate etc, you can avoid creating the primary key class.
    Remember in CMP the ejbCreate in the Home interface returns NULL while in BMP it is the primary key returned.
    HTH,
    Seetesh

  • Why in primary key class overrided in EJB?

    in EJB ... why in primary key class Object's Equals() and HashCode() method's were overridden ??

    please see the other question.. sorry for inconvinance..

  • Do I need to Create Primary Key Class for Entity beans with Local interface

    Do I need to Create Primary Key Class for Entity beans with Local interface?
    I have created my entity bean with the wizard in Sun One Studio and it does not create a primary key class for you.
    I thought that the primary key class was required. My key is made up of only one field.
    Anyone know the answer.
    Jim

    u dont need to create a primary key class for a entity bean.if ur table's primary key feild(int ,float) is a built in or primitive data type,then u dont need one.But if ur table has a primary key field which is non primitive (for example StudentID,ItemID etc)then u have to create a primary key class.
    hope this helps :-)

  • CMP Entity Beans with custom finders an primary key class

    Hi everybody.
    I've got a Entity with a primary key class and a custom finder. I've defined
    the finder into the xml file like iPlanet's documentation say, but, when I
    try to run the aplication I get the following error:
    Exception: SERVLET-run_failed: Failed in running template:
    /PruebaGI/PruebaGI/pruebagi.jsp, java.lang.ClassCastException:
    com.netscape.server.deployment.SessionBeanDescriptor
    Exception Stack Trace:
    java.lang.ClassCastException:
    com.netscape.server.deployment.SessionBeanDescriptor
    at
    com.netscape.server.servlet.servletrunner.AppInfo.popWebAppDescriptor(Unknow
    n Source)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.callJSP(Unknown
    Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callJsp
    Compiler(Unknown Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUri
    (Unknown Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUri
    RestrictOutput(Unknown Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformRequestDispatcher.forward(U
    nknown Source)
    at com.netscape.server.servlet.jsp.JSPRunner.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
    Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479).
    Could anybody help my? I need to resolve this question quickly.
    Thx
    ..

    Hi Juan,
    Sounds like you've defined either a java.lang.String where it should have
    said Java.util.Vector (or the other way around) in the part of the
    deployment descriptor that defines your custom finder method parameter.
    Regards,
    Raymond
    "Juan Jos� Ayuso" <[email protected]> wrote in message
    news:[email protected]...
    Hi everybody.
    I've got a Entity with a primary key class and a custom finder. I'vedefined
    the finder into the xml file like iPlanet's documentation say, but, when I
    try to run the aplication I get the following error:
    Exception: SERVLET-run_failed: Failed in running template:
    /PruebaGI/PruebaGI/pruebagi.jsp, java.lang.ClassCastException:
    com.netscape.server.deployment.SessionBeanDescriptor
    Exception Stack Trace:
    java.lang.ClassCastException:
    com.netscape.server.deployment.SessionBeanDescriptor
    at
    com.netscape.server.servlet.servletrunner.AppInfo.popWebAppDescriptor(Unknow
    n Source)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    atcom.netscape.server.servlet.servletrunner.ServletRunner.callJSP(Unknown
    Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callJsp
    Compiler(Unknown Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUri
    (Unknown Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUri
    RestrictOutput(Unknown Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformRequestDispatcher.forward(U
    nknown Source)
    at com.netscape.server.servlet.jsp.JSPRunner.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    atcom.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
    Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479).
    Could anybody help my? I need to resolve this question quickly.
    Thx

  • Foreign Keys in Primary Key Class

    I am a newbie on toplink. I am getting an error when i run ejbc against the jar file with EJB2.0. One of the primary key classes two primary keys and both are foreign Keys to other tables. Primary Key class looks like this:
    public class LcaCyberzoneAssocPK implements java.io.Serializable
    public ValueHolderInterface lcaHolder;
    public ValueHolderInterface cyberzoneDefHolder;
    public LcaCyberzoneAssocPK(ValueHolderInterface lcaHolder,
    ValueHolderInterface cyberzoneDefHolder)
    super();
    this.lcaHolder = lcaHolder;
    this.cyberzoneDefHolder = cyberzoneDefHolder;
    Bean Class has following four methods:
    public abstract Lca getLcaHolder()
    throws RemoteException;
    public abstract CyberzoneDef getCyberzoneDefHolder()
    throws RemoteException;
    public abstract void setLcaHolder(Lca arg1)
    throws RemoteException;
    public abstract void setCyberzoneDefHolder(CyberzoneDef arg1)
    throws RemoteException;
    The error it is throwing is:
    ERROR: Error from ejbc: In EJB LcaCyberzoneAssoc, lcaHolder is declared as oracle.toplink.indirection.ValueHolderInterface in the
    pk class, but the corresponding getLcaHolder() method in the bean class returns com.qwest.danconfig.server.ejb.entity.Lca. These t
    ypes must match.
    Can you please help how to fix this or what is the correct way of doing it.
    Second question is, is there any document which explains migrating toplink from EJB1.1 to EJB2.0?
    Thanks

    The EJB 2.0 spec does not really allow relationships in the primary key class. You may be able to get it to work by using the EJB classes, not ValueHolderInterface in primary key class.
    Otherwise you will need to double map the foreign key fields as direct fields to be compliant with the spec. You can still have the one-to-one mappings but your model will need to keep both in synch and mark the one-to-one mappings as read-only.

  • Deployment Tool Problem (J2EE -Composite primary Key Class)

    Hi !!
    e.g. I have an entiybean which has composite primary key class. So while deploying in J2EE tool u need to specify the Primary key class and the primary key field. well in case of a composite primary key class(if u have more than one field)...how do u declare all the fields for primary key class....
    if u r not getting me please tell me... See in J2EE deployment tool there is on section called Entity..in that see the Primary Key class (there u specify the Primary key class) and the Primary Key Field Name (the field name) Here u can just give only one Field name..if you have mulitple fields, then where you will specify... Please let me know..
    if anybody wants the code I will give the code...Please try to help..(how to deploy this kind of entity bean in J2EE deployment tool)
    -Bhumika

    Hi Bhumika,
    in case you have more than one field you need to write a Primary key class where the fields you want to be the key are member variables.
    your p.key class could look like this (it has to implement hash() and equals() ):
    public class PersonPK implements java.io.Serializable
    public int person_ID;
    public PersonPK()
    public PersonPK(int aPersonId)
    person_ID = aPersonId;
    public int hashCode()
    return person_ID;
    public boolean equals(Object ob)
    if (ob == this) return true;
    if (!(ob instanceof PersonPK)) return false;
    PersonPK other = (PersonPK) ob;
    if (person_ID != other.person_ID) return false;
    return true;
    -Hope this helps a bit,
    Anke

  • Comp. Primary key class-field mapping to DB columns problem.(EJB 2.0 CMP)

    Hi!
    I have deal with EJB 2.0 CMP bean.
    I have a composite PK so use the java class to store it. And there is a corresponding field in the Entity Bean with its primary key class type.
    The problem is: when deployment tool creates sql query for the findByPrimaryKey(PKClass ck)
    where ck is an object with 3 fielde : a_id, b_id, c_id.
    it says:
    <sql>SELECT "ck" FROM "MyTable" WHERE "ck" = ? </sql>
    And it means by the "ck" simple a column in DB but NOT the composite key which has to be splited into 3 different fields. So the container can't do the proper mapping.
    Does anyone know solutions?

    I was wrong about primary key class fields, take a look at Ejb2.0 Specification (10.8.2):
    The primary key class must be public, and must have a public constructor with no parameters.
    All fields in the primary key class must be declared as public.
    The names of the fields in the primary key class must be a subset of the names of the container-managed
    fields. (This allows the container to extract the primary key fields from an instance�s container-managed
    fields, and vice versa.)
    Right now I'm using BMP and I don't have this problems. Primary keys, calculated fields and types not supported by the DB can be easily achieved. But I understand your interest on CMP, is clearly evolving!

  • Entity Bean with Primary Key Class

    Hi
    I am trying to develop an entity bean attached to a key which have a
    composite key using Primary Key Class. When I use the findByPrimaryKey
    method of the bean it throws an exception as follows,
    java.sql.SQLException: Parameter typecheck failed: invalid parameter type:
    ORA-00000: normal, successful completion
    at com.netscape.server.jdbc.PreparedStatement.verifyError(Unknown Source)
    at com.netscape.server.jdbc.PreparedStatement.afterVerify(Unknown Source)
    at com.netscape.server.jdbc.PreparedStatement.executeQuery(Unknown Source)
    at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)
    at
    com.netscape.server.ejb.EntityDelegateManagerImpl.doPersistentFind(Unknown
    Source)
    at com.netscape.server.ejb.EntityDelegateManagerImpl.find(Unknown Source)
    at com.kivasoft.eb.EBHomeBase.findSingleByParms(Unknown Source)
    at
    TestBean2.ejb_home_TestBean2_EntityBean2Bean.findByPrimaryKey(ejb_home_TestB
    ean2_EntityBean2Bean.java:120)
    at
    TestBean2.ejb_kcp_skel_EntityBean2Home.findByPrimaryKey__TestBean2_EntityBea
    n2__TestBean2_TestBKey(ejb_kcp_skel_EntityBean2Home.java:258)
    at com.kivasoft.ebfp.FPRequest.invokenative(Native Method)
    at com.kivasoft.ebfp.FPRequest.invoke(Unknown Source)
    at
    TestBean2.ejb_kcp_stub_EntityBean2Home.findByPrimaryKey(ejb_kcp_stub_EntityB
    ean2Home.java:341)
    at
    TestBean2.ejb_stub_EntityBean2Home.findByPrimaryKey(ejb_stub_EntityBean2Home
    ..java:88)
    at TestBean2.Simple1.defaultAction(Simple1.java:115)
    at TestBean2.Simple1.doGet(Simple1.java:26)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
    Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    javax.ejb.FinderException
    at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)
    at
    com.netscape.server.ejb.EntityDelegateManagerImpl.doPersistentFind(Unknown
    Source)
    at com.netscape.server.ejb.EntityDelegateManagerImpl.find(Unknown Source)
    at com.kivasoft.eb.EBHomeBase.findSingleByParms(Unknown Source)
    at
    TestBean2.ejb_home_TestBean2_EntityBean2Bean.findByPrimaryKey(ejb_home_TestB
    ean2_EntityBean2Bean.java:120)
    at
    TestBean2.ejb_kcp_skel_EntityBean2Home.findByPrimaryKey__TestBean2_EntityBea
    n2__TestBean2_TestBKey(ejb_kcp_skel_EntityBean2Home.java:258)
    at com.kivasoft.ebfp.FPRequest.invokenative(Native Method)
    at com.kivasoft.ebfp.FPRequest.invoke(Unknown Source)
    at
    TestBean2.ejb_kcp_stub_EntityBean2Home.findByPrimaryKey(ejb_kcp_stub_EntityB
    ean2Home.java:341)
    at
    TestBean2.ejb_stub_EntityBean2Home.findByPrimaryKey(ejb_stub_EntityBean2Home
    ..java:88)
    at TestBean2.Simple1.defaultAction(Simple1.java:115)
    at TestBean2.Simple1.doGet(Simple1.java:26)
    [03/Aug/2001 15:26:41:7] error: Exception: SERVLET-execution_failed: Error
    in executing servlet Simat
    javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServletple1: java.lang.ClassCastException:
    com.netscape.server.deployment.EntityBeanDescriptor
    Exception .service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
    Source)Stack Trace:
    java.lang.ClassCastException:
    com.netscape.server.deployment.EntityBeanDescriptor
    a
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.ext
    com.netscape.server.servlet.servletrunner.AppInfo.popWebAppDescriptor(Unknow
    n Source)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at com.netscape.server.seecute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Threadrvlet.servletrunner.ServletRunner.execute(Unknown
    Source)
    at com.kivasoft.applogic.AppLogic.execu.run(Thread.java:479)
    te(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    Any kind of help is appreciated. I am using iPlanet App Builder 6.0 with iAS
    6.0 SP1.
    Thanks
    Bhaskara Murthy
    Eclipse Networks Inc

    "Bhamu" <[email protected]> wrote in message
    news:9keuo4$[email protected]..
    I am trying to develop an entity bean attached to a key which have a
    composite key using Primary Key Class. When I use the findByPrimaryKey
    method of the bean it throws an exception as follows,I notice that you are using the reference CMP plugin.
    at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)I'm also willing to bet that you may have created your own primary key class
    with a single field, rather than using the fields type as a primitive
    primary key class. If you do this, then SQLPersistenceManager will break.
    It is badly written, and has some stupid assumptions. The one I remember
    the most is that if you only have one primary key field, then
    SQLPersistenceManager assumes you have used a primitive type such as
    java.lang.String or java.lang.Integer, to represent it, rather than creating
    your own <Enity>Pk.java file.
    SQLPersistenceManager works for toy examples, but in general I would say it
    is broken and unusable. Either use BMP, or splash out the money for Coco
    Base from Thought Inc. Currently the only CMP plugin for iPlanet App server,
    other than the reference implementation, that I know of.

  • Why do we need to Register a class ?

    When the class is already present in jar file then still why do we need to load the class and use it. The jar file is included in the lib and would be available for the environment.
    If any better explanation is provided will be very useful
    Thanking you in advance

    I assume you are talking about JDBC drivers over here. In general, otherwise you do not need to register classes.
    In JDBC, this has to do with how DriverManager works.
    When you load a driver class using the Class.forName(...) block, you are effectively executing the driver's static block.
    The static block has some code in it to register the class with the DriverManager by calling the static method DriverManager.register(Driver d).
    When your client code attempts to connect to a database by passing a JDBC-URL, the DriverManager iterates through the registered drivers and calls acceptsURL() on each of the drivers. The first driver to return a value of true gets to try connecting to the database.

  • Primary Key Class Indicator mapping

    Hi
    We are using a Class Inidcator Field as described within Toplink documentation.
    We have encountered a problem, relating to the Class Indicator field not being populated within the Object within the cache,
    For example, the creation of one of our indictated objects successfully inserts the relevant class indicator value in the database, but the Object in the cache does not have the value set. This casues issues when attempting to identify the object in the cache.
    When re-reading the documentation at http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/descun007.htm#sthref2899 I noted the following line:
    "If the indicator field is part of the primary key, define a write-only transformation mapping for the indicator field (see Chapter 48, "Configuring a Relational Transformation Mapping"). "
    However following the documentaion trail, to http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/relmapun013.htm#CHDDBJJJ there is a statement:
    "Use transformation mappings only when mapping multiple fields into a single attribute. Because of the complexity of transformation mappings, it is often easier to perform the transformation with a converter or getter and setter methods of a direct-to-field mapping. See Chapter 38, "Configuring a Relational Direct-to-Field Mapping" for more information."
    Is there any definitive answer to correctly use a Class Indicator on a Primary Key field.
    Many Thanks
    Marc

    Hi,
    I'm still really struggling to find the correct way of implementing the mapping, as described within the documentation.
    As per the amended documentation quoted above, we are using a Primary Key field as the indentifier of a Class Indicator Mapping, and should therefore implement a "Read-Only Transformation Mapping for the indicator field".
    The explanation of how to implement Transformation Mappings in section 33-15,
    stipluates that both the "attribute transformer" - reading from the database,
    and the "field transformer" must be specified. By default, this would appear to
    be describing a read and write transformational mapping. Please correct me, if
    I am wrong.
    Therefore, we have currently found no method of implementing a "Read Only"
    transformational mapping for a Class Indicator Mapping.
    Any assistance in advising of the method of implementing this, would be greatly appreciated.
    Regards
    Marc

  • UNIQUE INDEX and PRIMARY KEYS

    Hi Friends,
    I am confused about primary keys.
    What is the purpose of this key again? I know it is used for unique constraints.
    Supposing I have a table with two (2) columns which are each indexed as unique.
    Then they can me both candidate at primary key right?
    So why do I need a primary key again? when I have 2 columns which are uniquely index?
    Thanks a lot

    A UNIQUE index creates a constraint such that all values in the index must be distinct. An error occurs if you try to add a new row with a key value that matches an existing row. This constraint does not apply to NULL values except for the BDB storage engine. For other engines, a UNIQUE index allows multiple NULL values for columns that can contain NULL
    The differences between the two are:
    1. Column(s) that make the Primary Key of a table cannot be NULL since by definition; the Primary Key cannot be NULL since it helps uniquely identify the record in the table. The column(s) that make up the unique index can be nullable. A note worth mentioning over here is that different RDBMS treat this differently –> while SQL Server and DB2 do not allow more than one NULL value in a unique index column, Oracle allows multiple NULL values. That is one of the things to look out for when designing/developing/porting applications across RDBMS.
    2. There can be only one Primary Key defined on the table where as you can have many unique indexes defined on the table (if needed).
    3. Also, in the case of SQL Server, if you go with the default options then a Primary Key is created as a clustered index while the unique index (constraint) is created as a non-clustered index. This is just the default behavior though and can be changed at creation time, if needed.
    So, if the unique index is defined on not null column(s), then it is essentially the same as the Primary Key and can be treated as an alternate key meaning it can also serve the purpose of identifying a record uniquely in the table.

  • Primary Key in CMP EEJB

    Is it necessary to have the hashcode() function and everything if my primary key is just a field? Is there any reason to make my primary key a class if it is only a simple String value? Please let me know.
    Thanks,
    -Davea

    Usually a primary key class is used only if you have a composite primary key .. meaning you have more than one primary key.
    hashcode() is needed for the container so that it can manage the primarykey class more efficiently.
    When you have a single primary key like String you dont need a primary key class.
    Regards,
    Meka Toka

  • Primary key based on multiple fields which are of a custom class type

    Hello!
    I have the following two classes.
    public class Application
    protected String appName;
    protected Set moduleOptions = new HashSet(); //Set<ModuleOption>
    public class Option
    protected String name;
    protected Application application;
    Now, I need for Option to have a composite primary key based on both its
    fields. How do I do this?
    For starters, I just need a few hints on how this should be done in Kodo
    because I already have this thing working in JPOX and that solution does
    not map directly to Kodo. JPOX defines the OptionPK (primary key class)
    to contain field ApplicationPK, and not Application. But Kodo does not
    accept this because of a mismatch between fields in class and its primary
    key class. (Not implying that Kodo should accept the same kind of
    solution.)
    Btw, I'm evaluating version 3.2.3.
    Thanks in advance!

    Viktor,
    The typical Kodo pattern for doing this is to create a private field in
    Option for each primary key in Application, map those fields as
    primary-key (but not the field of type Application), and therefore put
    those fields in the OptionPK. These fields should then be mapped to the
    same columns as the Application reference. Then, set the primary key
    fields to the same value as they are in the related object.
    Kodo allows multiple fields to be mapped to the same column in the
    database, and throws an exception if your actions would set the column
    to different values. So, typically, this might look like:
    public class Application
    protected String appName; // I'm assuming that this is the PK
    protected Set moduleOptions = new HashSet ();
    public class Option
    protected String name; // pk
    protected Application application; // not pk
    private String applicationAppName; // pk
    public Option (String n, Application a)
    name = n;
    application = a;
    applicationAppName = a.appName;
    -Patrick
    Viktor Matic wrote:
    Hello!
    I have the following two classes.
    public class Application
    protected String appName;
    protected Set moduleOptions = new HashSet(); //Set<ModuleOption>
    public class Option
    protected String name;
    protected Application application;
    Now, I need for Option to have a composite primary key based on both its
    fields. How do I do this?
    For starters, I just need a few hints on how this should be done in Kodo
    because I already have this thing working in JPOX and that solution does
    not map directly to Kodo. JPOX defines the OptionPK (primary key class)
    to contain field ApplicationPK, and not Application. But Kodo does not
    accept this because of a mismatch between fields in class and its primary
    key class. (Not implying that Kodo should accept the same kind of
    solution.)
    Btw, I'm evaluating version 3.2.3.
    Thanks in advance!

  • Entity bean with another class as primary key generator class

    Hi All,
    I have a CMP entity bean in which I generate the primary key using my own class know as unique id generator.
    I use it in ejbCreate method in the following manner
    public Long ejbCreate(HospitalData hospitalData) throws CreateException{
              Long myid = new Long(UniqueIdGenerator.getId());
              System.out.println("My id generated ====== "+myid);
              this.hospitalid = myid;
              System.out.println("My id generated ====== "+this.hospitalid);
              System.out.println("Came in ejbCreate method of HospitalEJB");
              this.hospitalname = hospitalData.getHospitalname();          
              return null;
    Can you tell me how I map this primary key in my ejb-jar.xml and jbosscmp-jdbc.xml.
    Anyhelp would be appreciated.
    Thanks
    Sameer

    "Bhamu" <[email protected]> wrote in message
    news:9keuo4$[email protected]..
    I am trying to develop an entity bean attached to a key which have a
    composite key using Primary Key Class. When I use the findByPrimaryKey
    method of the bean it throws an exception as follows,I notice that you are using the reference CMP plugin.
    at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)I'm also willing to bet that you may have created your own primary key class
    with a single field, rather than using the fields type as a primitive
    primary key class. If you do this, then SQLPersistenceManager will break.
    It is badly written, and has some stupid assumptions. The one I remember
    the most is that if you only have one primary key field, then
    SQLPersistenceManager assumes you have used a primitive type such as
    java.lang.String or java.lang.Integer, to represent it, rather than creating
    your own <Enity>Pk.java file.
    SQLPersistenceManager works for toy examples, but in general I would say it
    is broken and unusable. Either use BMP, or splash out the money for Coco
    Base from Thought Inc. Currently the only CMP plugin for iPlanet App server,
    other than the reference implementation, that I know of.

Maybe you are looking for

  • I have created separate user accounts for my 2 boys on my macbook. How do i get my itunes library onto their new ipods?

    I have created separate user accounts for my 2 boys on my macbook. How do i get my itunes library onto their new ipods?

  • Scatter Plot Problems

    I'm fairly new to Numbers, and I'm having difficulty making scatter plots with some of my data. For instance, I want to create a graph of strain versus force, with force on the x-axis and strain on the y-axis. I have my data in 2 rows, and when I sel

  • How do I set a password so no-one can use my PC?

    I tried "set user password" and "set administrator password" in BIOS but they don't work like it has on my previous PCs. I want it to ask for a password before even booting up Windows but instead it only asks for it to use the BIOS. Is there any sett

  • Gnome3 seems to leak memory until the system is unusable

    I recently upgraded to Gnome 3. I've had a number of problems but am working on getting them resolved. Currently the biggest one is probably that the gnome-shell process apparently has a big memory leak as far as I can tell. Right after booting it us

  • No Adobe Flash Player Alternative?

    I love to play games like Monster Busters and Candy Crush Soda on Facebook while on my phone. I just bought this Nokia Lumia 530 and have now realized it doesn't use Adobe Flash. Is there any way around this,or an alternative altogether? I miss my ga