7 Replies Latest reply on Apr 17, 2003 5:31 AM by Joern

    newbie: finder method in ejb-jar is ignored by jboss

    Joern Newbie

      Hi,

      i have some finder methods and they are dont called by jboss. i can create a new bean and i can call findByPrimaryKey which is not implemented in ejb-jar.xml. if i call the finder methods i get no exception, only an emty enumeration. i can write what i wont in ejb-ql, no excetion. i can delete all finder methods in my ejb-jar.xml, but i get an emty enumeration back.

      i'm realy confused, can somebody help or give a hint?

      Thanks a lot

        • 1. Re: newbie: finder method in ejb-jar is ignored by jboss
          Pablo Delgado Newbie

          Hi, it'd be much easier if you post here the ejb-jar.xml lines refering finder method that doesn't work.
          I have the following in my ejb-jar.xml and it works ...

          ......
          ......

          <query-method>
          <method-name>findTokens</method-name>
          <method-params>
          <method-param>java.lang.Long</method-param>
          <method-param>java.lang.Long</method-param>
          </method-params>
          </query-method>
          <ejb-ql>[CDATA[SELECT OBJECT(h) FROM Token h WHERE h.tokenprovider.idtokenprovider = ?1 AND h.idtokentype = ?2]]</ejb-ql>

          .....
          .....

          Note. These lines are generated by xdoclet.

          I hope this may help you.

          Pablo

          • 2. Re: newbie: finder method in ejb-jar is ignored by jboss
            Joern Newbie

            my ejb-jar.xml:

            <?xml version="1.0"?>
            <ejb-jar>
            <enterprise-beans>

            <ejb-name>E_Emotion</ejb-name>
            ejb.interfaces.E_EmotionHome
            ejb.interfaces.E_EmotionRemote
            <ejb-class>ejb.bean.E_EmotionBean</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>E_Emotion</abstract-schema-name>
            <cmp-field>
            <field-name>e_id</field-name>
            </cmp-field>
            <cmp-field>
            <field-name>e_bez</field-name>
            </cmp-field>
            <primkey-field>e_id</primkey-field>

            <query-method>
            <method-name>findEmotion</method-name>
            <method-params>
            <method-param>Integer</method-param>
            </method-params>
            </query-method>
            <ejb-ql>
            <![CDATA[SELECT o FROM E_Emotion o WHERE e_id = ?1]]>
            </ejb-ql>


            </enterprise-beans>
            </ejb-jar>

            maybe there is something i must declare first? must i use jbosscmp-jdbc.xml, or jboss.xml or is it optional?

            • 3. Re: newbie: finder method in ejb-jar is ignored by jboss
              Joern Newbie

              where is my posting? ok, once again:

              thanks for your reply...
              my ejb-jar.xml:

              <?xml version="1.0"?>
              <ejb-jar>
              <enterprise-beans>

              <ejb-name>E_Emotion</ejb-name>
              ejb.interfaces.E_EmotionHome
              ejb.interfaces.E_EmotionRemote
              <ejb-class>ejb.bean.E_EmotionBean</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>E_Emotion</abstract-schema-name>
              <cmp-field>
              <field-name>e_id</field-name>
              </cmp-field>
              <cmp-field>
              <field-name>e_bez</field-name>
              </cmp-field>
              <primkey-field>e_id</primkey-field>

              <query-method>
              <method-name>findEmotion</method-name>
              <method-params>
              <method-param>Integer</method-param>
              </method-params>
              </query-method>
              <ejb-ql>
              <![CDATA[SELECT o FROM E_Emotion o WHERE e_id = ?1]]>
              </ejb-ql>


              </enterprise-beans>
              </ejb-jar>


              i dont see any mistake. if something wrong, jboss should throw an exception?! must i declare something first? must i use jbosscmp-jdbc.xml or jboss.xml? is there a good documentation how to use cmp with jboss (maybe for free)?


              regards

              • 4. Re: newbie: finder method in ejb-jar is ignored by jboss
                Joern Newbie

                where is my posting? ok, once again:

                thanks for your reply...
                my ejb-jar.xml:

                <?xml version="1.0"?>
                <ejb-jar>
                <enterprise-beans>

                <ejb-name>E_Emotion</ejb-name>
                ejb.interfaces.E_EmotionHome
                ejb.interfaces.E_EmotionRemote
                <ejb-class>ejb.bean.E_EmotionBean</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>E_Emotion</abstract-schema-name>
                <cmp-field>
                <field-name>e_id</field-name>
                </cmp-field>
                <cmp-field>
                <field-name>e_bez</field-name>
                </cmp-field>
                <primkey-field>e_id</primkey-field>

                <query-method>
                <method-name>findEmotion</method-name>
                <method-params>
                <method-param>Integer</method-param>
                </method-params>
                </query-method>
                <ejb-ql>
                <![CDATA[SELECT o FROM E_Emotion o WHERE e_id = ?1]]>
                </ejb-ql>


                </enterprise-beans>
                </ejb-jar>


                i dont see any mistake. if something wrong, jboss should throw an exception?! must i declare something first? must i use jbosscmp-jdbc.xml or jboss.xml? is there a good documentation how to use cmp with jboss (maybe for free)?


                regards

                • 5. Re: newbie: finder method in ejb-jar is ignored by jboss
                  ali-gator Newbie

                  Your EJB-QL command is wrong. You must have:

                  SELECT OBJECT(o) FROM E_Emotion o WHERE e_id = ?1

                  Hope it'll help you.

                  • 6. Re: newbie: finder method in ejb-jar is ignored by jboss
                    Pablo Delgado Newbie

                    Try this EJB-QL query ...

                    .......
                    .......

                    <query-method>
                    <method-name>findEmotion</method-name>
                    <method-params>
                    <method-param>java.Lang.Integer</method-param>
                    </method-params>
                    </query-method>
                    <ejb-ql>
                    <![CDATA[SELECT OBJECT(o) FROM E_Emotion o WHERE o.e_id = ?1]]>
                    </ejb-ql>

                    .....
                    .....

                    • 7. Re: newbie: finder method in ejb-jar is ignored by jboss
                      Joern Newbie

                      Thanks for your help. It seems the finder method is called but i get an exception ObjectNotFoundException: No such entity!
                      But I know that I have an entity with e_id=1, i'm looking for... i call my finder like this:

                      home.findEmotion(new Integer(1))

                      please help again