4 Replies Latest reply on Jul 5, 2004 10:43 PM by Daniel O'Hare

    finder methods not working

    Daniel O'Hare Newbie

      Hi All-

      I have been searching for days to the solution to this problem- to no avail. I have a finder method: findByName(String name) and the requisite findByPrimaryKey(Integer key) methods in my home interface. The find by pk method works fine, the findByName does not. In the jboss log, I see sql being fired off for the find by pk, but not for the findByName method. It seems like jboss is not picking up the ejb-ql, even though it complains if I take the <ejb-ql> line out of the .

      I have created the required entries in my ejb-jar.xml and even made sure jboss was reading it by putting in bad xml to see if jboss generated errors which it did. I tried copying the same code into a META-INF\jbosscmp-jdbc.xml file and that didn't work either. Here are the code slices:

      public interface EntityTypeHome extends javax.ejb.EJBHome
      public EntityType create(String type_name)
      throws CreateException, RemoteException;

      public Collection findByName(String type_name)
      throws FinderException, RemoteException;

      public EntityType findByPrimaryKey(Integer type_code)
      throws FinderException, RemoteException;


      <?xml version="1.0"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">

      This bean represents an Entity Type.


      <ejb-ql>SELECT OBJECT(o) FROM entitytype AS o WHERE o.type_name = ?1></ejb-ql>



      This role represents everyone who is allowed full access
      to the Entity Type bean.






      All methods require a transaction



      I took out the jbosscmp-jdbc.xml file from the jar again, as from my (extensive!) research into this problem, it has become apparent that JBoss should be able to read the ejb-ql from my ejb-jar.xml file anyway. If I am mistaken in this let me know- but this thing still didn't work, even with it in there.

      Any help is greatly appreciated, I'll buy the beer on Friday!!! ;0)