0 Replies Latest reply on Sep 25, 2003 12:18 AM by hary

    finder using cmr fields - EJB-QL error

    hary Newbie

      Hi,

      Im getting the following error when deploying to jboss 3.2.1
      I'm using Eclipse and the plugin for jboss and xdoclet.

      org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT s.serviceBinding from Subscriber s where s.subscriberId = ?1'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "s.serviceBinding" at line 1, column 10.
      Was expecting one of:
      "DISTINCT" ...
      "OBJECT" ...
      <NUMERIC_VALUED_PATH> ...
      <STRING_VALUED_PATH> ...
      <DATETIME_VALUED_PATH> ...
      <BOOLEAN_VALUED_PATH> ...
      <ENTITY_VALUED_PATH> ...
      <VALUE_CLASS_VALUED_PATH> ...
      )
      The corresponding finder looks like

      ServiceBindingsEntityBean.java:
      * @ejb.finder
      * signature = "java.util.Collection findServiceBindings(java.lang.String subsId)"
      * view-type = "both"
      * description = "Find All service bindings for a subscriber"
      * query = "SELECT s.serviceBinding from Subscriber s where s.subscriberId = ?1"

      .....
      /**
      * @ejb.interface-method view-type = "local"
      * @ejb.persistent-field
      * @ejb.relation name = "subscriber-service-bindings"
      * target-ejb="Subscriber"
      * role-name="subscriber"
      * target-role-name="service-bindings"
      * @ejb.value-object
      * @jboss.relation fk-column="subscriber" related-pk-field="subscriberId"
      */
      public abstract SubscriberLocal getSubscriber();
      /**
      * @ejb.interface-method view-type = "local"
      */
      public abstract void setSubscriber(SubscriberLocal local);



      and in
      SubscriberEntityBean.java:

      /**
      * @ejb.interface-method view-type = "local"
      * @ejb.persistent-field
      * @ejb.relation name = "subscriber-service-bindings"
      * target-ejb="ServiceBinding"
      * target-role-name="subscriber"
      * role-name="service-bindings"
      *
      * @ejb.value-object
      * aggregate="com.alopa.metaserv.core.intf.ServiceBindingValue"
      * aggregate-name="ServiceBinding"
      * members="com.alopa.metaserv.core.intf.ServiceBindingLocal"
      * members-name="ServiceBinding" type = "Collection"
      * relation = "external"
      * @jboss.target-relation fk-column="subscriber"
      * related-pk-field="subscriberId"
      */
      public abstract Collection getServiceBinding();
      /**
      * @ejb.interface-method view-type = "local"
      */
      public abstract void setServiceBinding(Collection d);


      .....
      From ejb-jar.xml

      <![CDATA[EJB Entity Bean for Subscribers]]>
      <display-name>Subscriber Bean</display-name>

      <ejb-name>Subscriber</ejb-name>

      com.alopa.metaserv.core.intf.SubscriberHome
      com.alopa.metaserv.core.intf.Subscriber
      <local-home>com.alopa.metaserv.core.intf.SubscriberLocalHome</local-home>
      com.alopa.metaserv.core.intf.SubscriberLocal

      <ejb-class>com.alopa.metaserv.core.ejb.SubscriberCMP</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Subscriber</abstract-schema-name>
      <cmp-field >
      <![CDATA[]]>
      <field-name>subscriberId</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>status</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>PI</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>createTime</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>modifyTime</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>affiliation</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>serviceBinding</field-name>
      </cmp-field>
      <primkey-field>subscriberId</primkey-field>

      <!-- Write a file named ejb-finders-SubscriberEntityBean.xml if you want to define extra finders. -->



      and


      <![CDATA[Device and package binding for each service instance.]]>
      <display-name>Service Bindings</display-name>

      <ejb-name>ServiceBinding</ejb-name>

      <local-home>com.alopa.metaserv.core.intf.ServiceBindingLocalHome</local-home>
      com.alopa.metaserv.core.intf.ServiceBindingLocal

      <ejb-class>com.alopa.metaserv.core.ejb.ServiceBindingCMP</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>ServiceBinding</abstract-schema-name>
      <cmp-field >
      <![CDATA[Service Bindings ID.]]>
      <field-name>ID</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>serviceName</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>serviceStatus</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>serviceID</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>serviceImplementation</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>packageDeployment</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>subscriber</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>devices</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>subDevices</field-name>
      </cmp-field>
      <primkey-field>ID</primkey-field>

      <![CDATA[Find All service bindings for a subscriber]]>
      <query-method>
      <method-name>findServiceBindings</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <ejb-ql><![CDATA[SELECT s.serviceBinding from Subscriber s where s.subscriberId = ?1]]></ejb-ql>


      <!-- Write a file named ejb-finders-ServiceBindingEntityBean.xml if you want to define extra finders. -->


      and

      <ejb-relation >
      <ejb-relation-name>binding-package-deployment</ejb-relation-name>

      <ejb-relationship-role >
      <ejb-relationship-role-name>service-binding</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>ServiceBinding</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>packageDeployment</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role >
      <ejb-relationship-role-name>package-deployment</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>PackageDeployment</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>

      </ejb-relation>




      For some reason it appears the serviceBindings field does not appear to the server as an an entity.
      I am new to EJBs and I must be missing something. I can't figure out what.

      PS: Is this the right forum for such questions?