[prev in list] [next in list] [prev in thread] [next in thread]
List: jboss-user
Subject: SV: [JBoss-user] Returning single field as Collection with EJB QL
From: "Ulf Tidstrand" <ulf.tidstrand () imi ! chalmers ! se>
Date: 2003-10-31 14:46:19
[Download RAW message or body]
[Attachment #2 (text/plain)]
Ok. Thank you very much for your help, now it all makes sense... :)
Regards,
Ulf
-----Ursprungligt meddelande-----
Från: Adrian Brock [mailto:adrian@jboss.org]
Skickat: fr 2003-10-31 14:16
Till: jboss-user@lists.sourceforge.net
Kopia:
Ämne: RE: [JBoss-user] Returning single field as Collection with EJB QL
Use an ejbHome<METHOD> to invoke the ejbSelect<METHOD>
NOTE: If you do this, none of the CMP/CMR fields are usable
(there is no primary key)
Regards,
Adrian
On Fri, 2003-10-31 at 11:33, Jonathan.O'Connor@xcom.de wrote:
> 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" <ulf.tidstrand@imi.chalmers.se>
> Sent by: jboss-user-admin@lists.sourceforge.net
> 31.10.2003 11:03
> Please respond to jboss-user
>
> To: <jboss-user@lists.sourceforge.net>
> 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'Connor@xcom.de [mailto:Jonathan.O'Connor@xcom.de]
> Sent: den 31 oktober 2003 11:31
> To: jboss-user@lists.sourceforge.net
> 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" <ulf.tidstrand@imi.chalmers.se>
> Sent by: jboss-user-admin@lists.sourceforge.net
> 31.10.2003 07:47
> Please respond to jboss-user
>
> To: <jboss-user@lists.sourceforge.net>
> 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 ulf.tidstrand@imi.chalmers.se
> 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
> JBoss-user@lists.sourceforge.net
> 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
> JBoss-user@lists.sourceforge.net
> 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
> JBoss-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jboss-user
--
xxxxxxxxxxxxxxxxxxxxxxxx
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC
xxxxxxxxxxxxxxxxxxxxxxxx
-------------------------------------------------------
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
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user
["winmail.dat" (application/ms-tnef)]
-------------------------------------------------------
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
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic