I am unable to deploy a CMP using a pk.class as my primary key.
The container complains that it cannot find the variable 'id' which is from
the APK.class.
I believe my deployment descriptor in orion-ejb-jar.xml is incorrect but I
am unable to
figure it out. Any help would be appreciated.
Thanks. Craig.
Below is my test code:
**********************
public interface A extends javax.ejb.EJBObject {}
**********************
public interface AHome extends javax.ejb.EJBHome {
public A create(String id) throws
java.rmi.RemoteException,javax.ejb.CreateException;
public A findByPrimaryKey(APK pk) throws
java.rmi.RemoteException,javax.ejb.FinderException;
}
**********************
import javax.ejb.*;
import java.rmi.RemoteException;
public class ACMP implements javax.ejb.EntityBean {
private EntityContext entityContext;
// the pk class
public APK pk;
public APK getPK() {
return this.pk;
}
public void setPK(APK pk) {
this.pk = pk;
}
// dummy string.
public String dummy;
public String getDummy() {
return this.dummy;
}
public void setDummy(String dummy) {
this.dummy = dummy;
}
public APK ejbCreate(String id) throws CreateException {
this.pk = new APK(id);
return null;
}
public void ejbLoad() {}
public void ejbStore() {}
public void ejbActivate() {}
public void ejbPassivate() {}
public void setEntityContext(javax.ejb.EntityContext ctx) {
this.entityContext = ctx;
}
public void unsetEntityContext() {
entityContext = null;
}
public void ejbPostCreate(String id) throws CreateException,
RemoteException {}
public void ejbRemove() throws javax.ejb.RemoveException {}
}
**********************************
public class APK implements java.io.Serializable {
public java.lang.String id;
public APK() {}
public APK(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public boolean equals(){return true;}
public int hashCode() {return 1;}
}
*********************************
ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
<ejb-jar>
<display-name></display-name>
<enterprise-beans>
<entity>
<description>Testing</description>
<ejb-name>testA</ejb-name>
<home>AHome</home>
<remote>A</remote>
<ejb-class>ACMP</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>APK</prim-key-class>
<reentrant>False</reentrant>
<primkey-field>pk</primkey-field>
<cmp-field>
<description>Primary Key.</description>
<field-name>pk</field-name>
</cmp-field>
<cmp-field>
<description>dummy field</description>
<field-name>dummy</field-name>
</cmp-field>
</entity>
</enterprise-beans>
<assembly-descriptor>
</assembly-descriptor>
</ejb-jar>
***********************************
orion-ejb-jar.xml (same meta-inf folder as ejb-jar.xml)
<?xml version="1.0"?>
<!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1
runtime//EN" "http://www.orionserver.com/dtds/orion-ejb-jar.dtd">
<orion-ejb-jar deployment-version="1.5.2" deployment-time="e80ee7188d">
<enterprise-beans>
<entity-deployment name="testA" location="testA"
wrapper="testA_EntityHomeWrapper8" max-tx-retries="3" table="testA"
data-source="jdbc/OracleDS">
<primkey-mapping>
<cmp-field-mapping name="pk">
<properties>
<cmp-field-mapping name="id"
persistence-name="primkeyId" />
</properties>
</cmp-field-mapping>
</primkey-mapping>
<cmp-field-mapping name="dummy"
persistence-name="dummyField" />
<finder-method query="">
<method>
<ejb-name>A</ejb-name>
<method-name>findAll</method-name>
<method-params>
</method-params>
</method>
</finder-method>
</entity-deployment>
</enterprise-beans>
<assembly-descriptor>
<default-method-access>
<security-role-mapping
name="<default-ejb-caller-role>" impliesAll="true" />
</default-method-access>
</assembly-descriptor>
</orion-ejb-jar>
******************************************