0 Replies Latest reply on Nov 2, 2002 4:59 PM by john towell

    custom finder with dependent-value-class

    john towell Newbie

      Does anybody know what the ejb-ql syntax is for creating a custom finder using a dependent value class? If I have an Entity bean Customer that is using a dependent value object Name. And I wanna create a finder that gets Customers by last name. So here is the XML.

      ----jbosscmp-jdbc.xml----------
      <dependent-value-class>
      Name
      com.aaw.common.beans.Name

      <property-name>title</property-name>
      <column-name>title</column-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>


      <property-name>first</property-name>
      <column-name>first</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(16)</sql-type>


      <property-name>middle</property-name>
      <column-name>middle</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(1)</sql-type>


      <property-name>last</property-name>
      <column-name>last</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(16)</sql-type>


      <property-name>suffix</property-name>
      <column-name>suffix</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(16)</sql-type>

      </dependent-value-class>
      -------------------------------------------------------
      ----------ejb-jar------------------------------

      <display-name>Customer</display-name>
      <ejb-name>CustomerEJB</ejb-name>
      <local-home>com.aaw.ejbcontainer.domain.CustomerHome</local-home>
      com.aaw.ejbcontainer.domain.Customer
      <ejb-class>com.aaw.ejbcontainer.domain.CustomerBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Integer</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>customer</abstract-schema-name>
      <cmp-field>
      <field-name>id</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>isActive</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>name</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>email</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>homeNumber</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>workNumber</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>mobileNumber</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>faxNumber</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>sendEmailReminders</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>sendPostalReminders</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>sendFaxReminders</field-name>
      </cmp-field>
      <primkey-field>id</primkey-field>

      <query-method>
      <method-name>findByLastName</method-name>
      <method-params><method-param>java.lang.String</method-param></method-params>
      </query-method>
      <ejb-ql><![CDATA[
      SELECT OBJECT(c) FROM customer c WHERE c.name.last = ?1
      ]]></ejb-ql>


      ------------------------------------------

      What would the syntax be? c.name.last and c.name_last don't work. Is there a way to do this?