1 Reply Latest reply on Sep 22, 2004 3:07 PM by cracru

    In a Pickle with parent-child relationship and CMR

    edwar64896

      am getting in a pickle with a parent-child relationship and CMR. JBoss 3.2.5 is not wanting to deploy - claiming a CMR field error. Should I be using a finder here? Not sure. Please forgive newbie question...

      22:51:48,467 ERROR [EntityContainer] Starting failed jboss.j2ee:jndiName=ejb/pixStore/Tag,service=EJB
      org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT OBJECT(p) FROM Tag p WHERE p.Parent.id = ?1'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.UnknownPathException: Unknown cmr field in path: at line 1, column 43. Encountered: "Parent" after: "p.")

      TIA, Mark.

      /*
       * Created on 12/09/2004
       *
       * TODO To change the template for this generated file go to
       * Window - Preferences - Java - Code Style - Code Templates
       */
      package pixStore.ejb;
      
      import java.rmi.RemoteException;
      
      import javax.ejb.EJBException;
      import javax.ejb.EntityBean;
      import javax.ejb.EntityContext;
      import javax.ejb.RemoveException;
      
      /**
       * @ejb.bean name="Tag"
       * display-name="Name for Tag"
       * description="Description for Tag"
       * jndi-name="ejb/pixStore/Tag"
       * type="CMP"
       * cmp-version="2.x"
       * view-type="both"
       *
       *
       *
       * @ejb.finder signature = "Collection findByParent(int tag)"
       * role-name = "Tag-Has-One-Parent"
       * query = "SELECT OBJECT(p) FROM Tag p WHERE p.Parent.id = ?1"
       *
       *
       */
      public abstract class TagBean implements EntityBean {
      //etc...
       /**
       * @ejb.pk-field
       * @ejb.persistent-field
       * @ejb.interface-method
       *
       * @jboss.persistence auto-increment = "true"
       * @jboss.column-name name = "Id"
       *
       */
       public abstract int getId();
       public abstract void setId(int Id);
       private int Id;
      
       /**
       * @ejb.persistent-field
       * @ejb.interface-method
       *
       * @jboss.column-name name = "Tag"
       */
       public abstract String getTag();
       public abstract void setTag(String Id);
       private String Tag;
      
       /**
       * @ejb.persistent-field
       * @ejb.interface-method
       *
       * @ejb.relation name = "TagParentChild"
       * role-name = "Tag-Has-One-Parent"
       * target-ejb = "Tag"
       * target-multiple = "yes"
       *
       *
       * @jboss.column-name name = "Parent"
       */
       public abstract pixStore.interfaces.Tag getParent();
       public abstract void setParent(pixStore.interfaces.Tag Parent);
       private pixStore.interfaces.Tag Parent;
      
      }