I am under the impression that custom finders (ejbFindBy...) are
supported under CMP.
Just add the FindBy method in the home interface and all should be well.


ps. I hope it works, I'll need to code some real soon :)

btw. as a precision, what you return is the primary key class... be it
Integer, String, CustomPK etc.
and also, returning a Collection should work AFAIK.

HTH

Daniel

-----Message d'origine-----
De : Ijonas Kisselbach [mailto:[EMAIL PROTECTED]]
Envoyé : 19 avril, 2001 13:08 
À : [EMAIL PROTECTED]
Objet : Re: [JBoss-user] Finder method question


Using BMP this is definitely possible. All you would have is a finder
method
which looks something like this:

public String ejbFindByFirstName(Person p) {

    PreparedStatement pstmt = myDBConnection.prepareStatement("select
emp_id
from employee where firstname = ?");
    pstmt.setString(1, p.getFirstName());
    ResultSet res = pstmt.executeQuery();

    // parse the results

    return strEmpId;
}

Not sure how this would work under CMP.

Hope it helps,
Ijonas.

----- Original Message -----
From: "Nordahl, David C" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 19, 2001 4:27 PM
Subject: [JBoss-user] Finder method question


> I'm wondering if it is possible to create a finder method for an
attribute
> which is nested in another object attribute of my bean.  For example,
say
I
> have an Employee bean with an attribute of type Person (non bean)
which
has
> an attribute of last and first name, and I want to make a method
> findByFirstName.  Is this possible? And if so how is it done?
>
> _______________________________________________
> 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

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to