And if you are using EJB 2.0 style CMP, hopefully, the primaryKey is defined
as:

public abstract String getPrimaryKey();
public abstract void setPrimaryKey(String key);

or as a

public String primaryKey;

in a 1.0 style CMP.

Methods.

Right?

-AP_



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Jack C. Miller
Sent: Thursday, October 11, 2001 2:32 PM
To: Orion-Interest
Subject: problem using primary key class with orion



I am having some difficulty getting orion to use my primary key class
during deployment.  I have an EJB AnyPerson with which I use a primary key
class AnyPersonKey that has a public java.lang.String primaryKey field.
During deployment, I get a compilation error that looks like the CMP isn't
being generated properly.

The orion-ejb-jar.xml file looks fine, as does the ejb-jar file.  I get
this error on deploy:

Auto-deploying kwu-ejb.jar (Classes were updated)... Error compiling
C:\orion\applications\kwu-phase-2\kwu-ejb.jar: Incompatible type for
prim-key-class and type of the specified primkey-field: Cannot convert
from class com.kw.kwu.model.AnyPerson.AnyPersonKey to class
java.lang.String

It doesn't seem to recognize that I'm using a primary key class at all,
even though it is mapped in the orion-ejb-jar.xml file.

Has anyone got a working example of this?  I'm tired of tweaking the
orion-ejb-jar to try and get it working.

 Here's a snippet from my orion-ejb-jar.xml:

        <enterprise-beans>
                <entity-deployment name="AnyPerson" location="AnyPerson"
wrapper="AnyPersonHome_EntityHomeWrapper45" max-tx-retries="3"
table="AnyPerson" data-source="jdbc/SQLServerDSCore">
                        <primkey-mapping>
                                <cmp-field-mapping>
                                    <fields>
                                        <cmp-field-mapping
name="primaryKey" persistence-name="primaryKey" />
                                    </fields>
                                </cmp-field-mapping>
                        </primkey-mapping>
                        <cmp-field-mapping name="FirstName"
persistence-name="FirstName" />
                        <cmp-field-mapping name="LastName"
persistence-name="LastName" />
                        <cmp-field-mapping name="Salutation"
persistence-name="Salutation" />
                        <cmp-field-mapping name="Username"
persistence-name="Username" />
                        <cmp-field-mapping name="Password"
persistence-name="Password" />
                        <cmp-field-mapping name="Address1"
persistence-name="Address1" />
                        <cmp-field-mapping name="Address2"
persistence-name="Address2" />
                        <cmp-field-mapping name="City"
persistence-name="City" />
                        <cmp-field-mapping name="StateProvId"
persistence-name="StateProvId" />
                        <cmp-field-mapping name="PostalCd"
persistence-name="PostalCd" />
                        <cmp-field-mapping name="Country"
persistence-name="Country" />
                        <cmp-field-mapping name="HomePhone"
persistence-name="HomePhone" />
                        <cmp-field-mapping name="Fax"
persistence-name="Fax" />
                        <cmp-field-mapping name="Email"
persistence-name="Email" />
                        <cmp-field-mapping name="LastModTime"
persistence-name="LastModTime" />
                        <cmp-field-mapping name="ModifiedBy"
persistence-name="ModifiedBy" />


and the matching ejb-jar.xml file:

<ejb-jar>
   <description>Generated deployment descriptors</description>
          <enterprise-beans>
                <entity>
                        <ejb-name>AnyPerson</ejb-name>

<home>com.kw.kwu.model.AnyPerson.AnyPersonHome</home>

<remote>com.kw.kwu.model.AnyPerson.AnyPerson</remote>

<ejb-class>com.kw.kwu.model.AnyPerson.AnyPersonBean</ejb-class>
                        <persistence-type>Container</persistence-type>

<prim-key-class>com.kw.kwu.model.AnyPerson.AnyPersonKey</prim-key-class>
                        <reentrant>false</reentrant>
                        <cmp-field><field-name>primaryKey</field-name>

<cmp-field><field-name>FirstName</field-name></cmp-field>

<cmp-field><field-name>LastName</field-name></cmp-field>

<cmp-field><field-name>Salutation</field-name></cmp-field>

<cmp-field><field-name>Username</field-name></cmp-field>

<cmp-field><field-name>Password</field-name></cmp-field>

<cmp-field><field-name>Address1</field-name></cmp-field>

<cmp-field><field-name>Address2</field-name></cmp-field>

<cmp-field><field-name>City</field-name></cmp-field>

<cmp-field><field-name>StateProvId</field-name></cmp-field>

<cmp-field><field-name>PostalCd</field-name></cmp-field>

<cmp-field><field-name>Country</field-name></cmp-field>

<cmp-field><field-name>HomePhone</field-name></cmp-field>

<cmp-field><field-name>Fax</field-name></cmp-field>

<cmp-field><field-name>Email</field-name></cmp-field>

<cmp-field><field-name>LastModTime</field-name></cmp-field>

<cmp-field><field-name>ModifiedBy</field-name></cmp-field>
                        <primkey-field>primaryKey</primkey-field>
                </entity>

Thanks!

Jack Miller




Reply via email to