geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacek Laskowski <jlaskow...@apache.org>
Subject Re: How can I get rid of javax.ejb.NoSuchObjectLocalException?
Date Fri, 08 Jul 2005 11:32:50 GMT
Gianny Damour wrote:

> AddressEJB has an unknown primary key. You need to:
> * define an additional CMP field;
> e.g.
>            <cmp-field-mapping>
>                <cmp-field-name>id</cmp-field-name>
>                <cmp-field-class>java.lang.Integer</cmp-field-class>
>                <table-column>id</table-column>
>            </cmp-field-mapping>
> 
> * mark this field as a primary key field (in the openejb-jar.xml DD); and
> e.g.
>           <primkey-field>id</primkey-field>
> 
> * declare an automatic pk generator to set its value.
> There were some recent changes and I do not know how it works.

Here's the relevant snippet from customer-ejb-plan.xml:

    <entity>
       <ejb-name>AddressEJB</ejb-name>
       <table-name>ADDRESSES</table-name>
       <cmp-field-mapping>
         <cmp-field-name>id</cmp-field-name>
         <cmp-field-class>java.lang.Integer</cmp-field-class>
         <table-column>id</table-column>
       </cmp-field-mapping>
       <cmp-field-mapping>
         <cmp-field-name>zipCode</cmp-field-name>
         <table-column>zipCode</table-column>
       </cmp-field-mapping>
       <cmp-field-mapping>
         <cmp-field-name>state</cmp-field-name>
         <table-column>state</table-column>
       </cmp-field-mapping>
       <cmp-field-mapping>
         <cmp-field-name>streetName2</cmp-field-name>
         <table-column>streetName2</table-column>
       </cmp-field-mapping>
       <cmp-field-mapping>
         <cmp-field-name>streetName1</cmp-field-name>
         <table-column>streetName1</table-column>
       </cmp-field-mapping>
       <cmp-field-mapping>
         <cmp-field-name>country</cmp-field-name>
         <table-column>country</table-column>
       </cmp-field-mapping>
       <cmp-field-mapping>
         <cmp-field-name>city</cmp-field-name>
         <table-column>city</table-column>
       </cmp-field-mapping>
       <primkey-field>id</primkey-field>
       <automatic-key-generation>
 
<generator-name>geronimo.server:J2EEServer=geronimo,J2EEApplication=petstore,J2EEModule=customer-ejb,j2eeType=PKGenerator,name=AutoEntityGenerator</generator-name>
         <primary-key-class>java.lang.Integer</primary-key-class>
       </automatic-key-generation>
     </entity>

  <gbean 
gbeanName="geronimo.server:J2EEServer=geronimo,J2EEApplication=petstore,J2EEModule=customer-ejb,j2eeType=PKGenerator,name=AutoEntityGenerator"

class="org.openejb.entity.cmp.pkgenerator.AutoIncrementTablePrimaryKeyGeneratorWrapper">
     <reference name="ManagedConnectionFactoryWrapper">
 
<gbean-name>geronimo.server:JCAResource=geronimo-derby-connector-1.0-SNAPSHOT.rar,name=DerbyDatasource,J2EEServer=geronimo,J2EEApplication=petstore,j2eeType=JCAManagedConnectionFactory</gbean-name>
     </reference>
     <attribute name="sql" type="java.lang.String">
       insert into customer_ejb_sequence_table (dummy) values (1)
     </attribute>
     <attribute name="returnType" type="java.lang.Class">
       java.lang.Integer
     </attribute>
   </gbean>

Is there anything I missed and should be in the descriptor?

> Gianny

Jacek


Mime
View raw message