Ulf,
Correct. But you may be able to attach this to the home interface where it 
makes more sense. Sorry, I'm not sure how to do this, although it should 
be easy.
Ciao,
Jonathan O'Connor




"Ulf Tidstrand" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
31.10.2003 11:03
Please respond to jboss-user
 
        To:     <[EMAIL PROTECTED]>
        cc: 
        Subject:        RE: [JBoss-user] Returning single field as 
Collection with EJB QL


Thanks, that made it much clearer!

But then I have a follow-up question: As I've understood, the ejbSelect
methods are only available locally from within the EJB itself. So if I
would like to make a general getAllLastNames() method returning all
LastNames in a table (not associated to a special entity), I should do
the following:

1. Implement an abstract ejbSelectLastNames() method in the bean with a
corresponding EJB QL statement
2. Implement a getLastNames() as an interface method in the EJB which in
turn calls the ejbSelectLastNames() method
3. When I want to invoke the getLastNames() method from a client, I
first have to find an arbitrary entity bean and then invoke the method
from that bean.

Is that right?

Regards,
Ulf

-----Original Message-----
From: Jonathan.O'[EMAIL PROTECTED] [mailto:Jonathan.O'[EMAIL PROTECTED] 
Sent: den 31 oktober 2003 11:31
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Returning single field as Collection with EJB
QL

Ulf,
You need an ejb.select instead. Finders are defined to return the Entity

Bean interface (local or remote). Select() lets you find non entity bean

stuff.
to be more specific, in an Entity Bean, FooBean, finders always return 
FooRemote or FooLocal objects. Use ejb.Select to return other stuff such

as your last names.
Ciao,
Jonathan O'Connor
XCOM Dublin




"Ulf Tidstrand" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
31.10.2003 07:47
Please respond to jboss-user
 
        To:     <[EMAIL PROTECTED]>
        cc: 
        Subject:        [JBoss-user] Returning single field as
Collection 
with EJB QL


Hi everyone,
 
I have declared a simple EJB QL statement in xdoclet:
 
 * @ejb.finder
 *    signature="java.util.Collection findAllLastNames()"
 *    query="SELECT DISTINCT u.lastName FROM user AS u"
 
The lastName field is of type String, so I thought that this statement 
would return all uniqe last names in the table as a Collection of
String. 
However it seems to return a Collection of local interfaces instead. 
That?s fine, but the problem is that the primary key fields are not set
in 
those local interfaces so whenever I try to fetch the ?lastName? field 
with getLastName() from the local interface, Jboss throws a couple of 
exceptions telling me that the primary key is null.
 
If I invoke the toString() method of the local interfaces I get the JNDI

name of the EJB followed by the content of the lastName field, so the 
information is obviously there, but I can?t get it out in a clean way. 
What am I doing wrong?
 
I?m using JBoss 3.2.2 (final production version).
 
Regards,
Ulf
 
Ulf Tidstrand
Software Engineer
IMI - Industrial Environmental Informatics
Chalmers University of Technology

Voice  +46 31 772 4914
Fax    +46 31 772 4915
E-mail [EMAIL PROTECTED]
Web    www.imi.chalmers.se
 



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to