0 Replies Latest reply on Mar 18, 2002 4:12 AM by Sven Hoffmann

    Problem with PK (JBoss 2.4.4)

    Sven Hoffmann Newbie


      I have a problem with deploying Entity Beans (CMP 1.1, JBoss 2.4.4). I get the folowing error:

      Bean : Example
      Warning: The type of the field named in the primkey-field element must match the class in the prim-key-class element.

      Has anybody an idea? As far as I can see the code below should work.

      Thx in advance,

      Sven Hoffmann

      My implementation class is:
      package com.tradingfair.vtr2;

      import java.rmi.*;
      import javax.ejb.*;

      public class Example implements EntityBean {
      //my fields
      public Long orderId;
      public String description;

      //JBoss Entity Context
      private EntityContext context;
      //for generating unique ids (chances are good that this does not work, but that is not the problem right now)
      private static int instcnt = 0;

      //Beans need a public parameterless constructor
      public Example() {

      //JBoss methods
      public void setEntityContext(EntityContext aContext) {
      context = aContext;

      public void unsetEntityContext() {
      context = null;

      public Long ejbCreate() {
      orderId = getNewOrderId();
      return null;

      public void ejbPostCreate() {

      public void ejbActivate() {

      public void ejbPassivate() {

      public void ejbLoad() {

      public void ejbStore() {

      public void ejbRemove() {
      //end JBoss methods

      //Getter/Setter + Logic
      private Long getNewOrderId() {
      return new Long(++instcnt);

      * Gets the description.
      * @return Returns a String
      public String getDescription() {
      return description;

      * Sets the description.
      * @param description The description to set
      public void setDescription(String description) {
      this.description = description;

      * Gets the orderId.
      * @return Returns a Long
      public Long getOrderId() {
      return orderId;

      ... and my ejb-jar.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      Example Entity Bean