I don't know if you and Fred are looking at the same problem.
Your home and the jaws.xml should both be findByIdAndName, you shouldn't
have an ejbFindByIdAndName, since you're declaring it in the descriptor.
Fred's issue is that JBoss currently _requires_ the 'By'. I believe this
is only true of autogenerated single column finders. Fred, can you
confirm that what I just said summarizes your problem. No to fix that so
that find... or findBy... are supported, how does JAWS tell cases where
the field name starts with 'by' from a 'findBy...' Hmm that's a problem
anyway isn't it. I guess in those cases, you'd have to define the finder
in jaws.xml
Nathan, looking at the JAWS code, the only thing I could think of that
would cause your problem would be that JAWS gets a bad copy of jaws.xml,
without your finder declaration in it. Is it possible that it's getting
another copy out of your classpath, or somewhere. The only other thing
is a non-obvious, non-visible difference between the finder method's
name in the home interface and the name in jaws.xml. Do you have any
whitespace in the method name in jaws.xml (including line breaks)?
-danch
nathan frund wrote:
> Fred, thanks for the reply. I just want to make sure
> I have everything correct so that I can give you
> accurate information back for a potential patch.
>
> In my Home interface I put:
>
>
> public Collection ejbFindByIdAndName(Integer id,
> String name) throws RemoteException, FinderException
>
>
> In jaws.xml I put:
>
> <finder>
> <name>ejbFindByIdAndName</name>
> <query><![CDATA[ID = {0} AND NAME={1}]]></query>
> <order>id DESC</order>
> </finder>
>
> I know I must be doing something wrong because when I
> put ejbFindBy... in the Home interface I get this
> error message upon deployment:
>
> Could not deploy
> file:/home/local/JBoss-2.2.2_Tomcat-3.2.2/jboss/tmp/deploy/Default/xwl.jar,
> Cause:org.jboss.ejb.DeploymentException: Could not
> find matching method for public abstract
> java.util.Collection
>
>com.nathanfrund.xwl.ArticleHome.ejbFindByIdAndName(java.lang.Integer,java.lang.String)
> throws
> javax.ejb.FinderException,java.rmi.RemoteException
>
>
>
>
> --- Fred Loney <[EMAIL PROTECTED]> wrote:
>
>>You may have discovered a bug. As far as I can
>>tell, jboss incorrectly filters out custom finder
>>methods that don't begin with "ejbFindBy". Your
>>method is filtered out. An attempt is made to
>>autogenerate a finder, which results in the
>>indicated message.
>>
>>Change the name of your method to ejbFindByIdAndName
>>and try again. If that works, let me know and I'll
>>submit a patch.
>>
>>--
>>Fred Loney
>>Spirited Software, Inc.
>>[EMAIL PROTECTED]
>>
>>nathan frund wrote:
>>
>>
>>>Howdy,
>>>
>>>I'm new to both EJB and JBoss and boy, do I have a
>>>problem. I've been over the documentation on the
>>>JBoss web site for days and through the mailing
>>>
>>list
>>
>>>archive from top to bottom but didn't find anyone
>>>
>>else
>>
>>>having this specific problem.
>>>
>>>I can't get certain custom finders to work.
>>>
>>>This is the error message I get in the JBoss log
>>>
>>when
>>
>>>starting the server:
>>>
>>> [Container factory] Finder:idandname
>>> [JAWS] Could not create the finder
>>>
>>findByIdAndName,
>>
>>>because no matching CMP field was found.
>>>
>>>================================================
>>>
>>>Here is the snippet from the included jaws.xml:
>>>
>>> <entity>
>>> <ejb-name>ArticleBean</ejb-name>
>>>
>>>
>><pk-constraint>true</pk-constraint>
>>
>>> <cmp-field>
>>>
>>>
>><field-name>id</field-name>
>>
>>>
>>>
>><column-name>ID</column-name>
>>
>>> </cmp-field>
>>> <cmp-field>
>>> <field-name>name</field-name>
>>> <column-name>NAME</column-name>
>>> </cmp-field>
>>> <finder>
>>> <name>findById</name>
>>> <query>ID = {0}</query>
>>> <order>ID DESC</order>
>>> </finder>
>>> <finder>
>>>
>>>
>><name>findByIdAndName</name>
>>
>>> <query><![CDATA[id ={0}
>>>
>>AND
>>
>>>name={1}]]></query>
>>> <order>id DESC</order>
>>> </finder>
>>> </entity>
>>>
>>>
>>===================================================
>>
>>>Here is the Home interface of the EJB:
>>>
>>>package com.nathanfrund.xwl;
>>>
>>>import java.rmi.RemoteException;
>>>import javax.ejb.*;
>>>import java.util.Collection;
>>>
>>>/**
>>>This interface defines the home interface for the
>>>'Article' EJB.
>>>*/
>>>public interface ArticleHome extends EJBHome
>>>{
>>> /**
>>> Create a new XWL instance.
>>> */
>>> public Article create(Integer id) throws
>>>RemoteException, CreateException;
>>>
>>> /**
>>> Find the Article with the specified ID. This
>>>method is not implemented by
>>> the Bean, but by the container.
>>> */
>>> public Article findByPrimaryKey(Integer id)
>>>
>>throws
>>
>>>RemoteException, FinderException;
>>>
>>> /**
>>> Finds the Article whose 'name' attribute
>>>
>>matches
>>
>>>that specified. This
>>> method is implemented byt he container
>>> */
>>> public Collection findByName(String name)
>>>
>>throws
>>
>>>RemoteException, FinderException;
>>>
>>> /**
>>> Get all Article instances. This method is
>>>implemented by the container
>>> */
>>> public Collection findAll() throws
>>>RemoteException, FinderException;
>>>
>>> public Collection findByIdAndName(Integer id,
>>>String name) throws RemoteException,
>>>
>>FinderException;
>>
>>>}
>>>
>>>
>>>
> =====================================================
>
>>>The overridden "findById" works perfectly and of
>>>course the "findByIdAndName" returns an empty
>>>Collection when called by a client. Any help
>>>
>>would be
>>
>>>*GREATLY* appreciated.
>>>
>>>For completeness sake here's the CMP bean:
>>>
>>>
>>>
> =======================================================
>
>>>package com.nathanfrund.xwl;
>>>
>>>import java.rmi.RemoteException;
>>>import javax.ejb.*;
>>>import org.jboss.util.AutoNumberFactory;
>>>/**
>>>This class contains the implementation for the
>>>
>>methods
>>
>>>specified in the home
>>>and remote interfaces for the 'XWL' EJB.
>>>*/
>>>public class ArticleBean implements EntityBean
>>>{
>>> transient private EntityContext ctx;
>>>
>>> static java.util.Date now = new
>>>
>>java.util.Date();
>>
>>> public Integer id;
>>> public boolean reviewed;
>>> public java.sql.Date date;
>>> public java.sql.Time time;
>>> public String topic;
>>> public String title;
>>> public String department;
>>> public String summary;
>>> public String body;
>>> public String name;
>>> public String email;
>>>
>>> /**
>>> Create an instance of a CD. Note that
>>>
>>this
>>
>>>method returns null because
>>> the real creation is managed by the EJB
>>>container.
>>> */
>>> public Integer ejbCreate (Integer _id)
>>> {
>>> id =
>>>AutoNumberFactory.getNextInteger("ArticleBean");
>>> date = new java.sql.Date(now.getTime());
>>> time = new java.sql.Time(now.getTime());
>>> return null;
>>> }
>>>
>>> /**
>>> Called when the object has been
>>>
>>instantiated;
>>
>>>does nothing here.
>>> */
>>> public void ejbPostCreate(Integer id){}
>>>
>>> public Integer getId(){ return id; }
>>>
>>> public boolean getReviewed(){ return reviewed;
>>>
>>}
>>
>>> public void setReviewed(boolean _reviewed){
>>>reviewed = _reviewed; }
>>>
>>> public java.sql.Date getDate(){ return date; }
>>>
> === message truncated ===
>
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
>
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user