Article View: weblogic.developer.interest.ejb.cmp
Article #1need help with ejbSelect returning all instances of a field
From: Steve Lewis
Date: Thu, 12 Aug 2004 22:59
Date: Thu, 12 Aug 2004 22:59
51 lines
2541 bytes
2541 bytes
I am having a lot trouble generating a simple EJB-QL query to return
one attribute from all objects in a table
In the header I say
* @ejb.bean name="MlbTeam"
jndi-name="com.babel17.fbdraft.bean.MlbTeam"
* type="CMP" primkey-field="teamId" schema="MlbTeam"
* cmp-version="2.x" data-source="java:/FBDraft"
*
* @ejb.finder query="SELECT OBJECT(a) FROM MlbTeam as a"
* signature="java.util.Collection findAll()"
The finder works
I have an attribute teamName
I say
/**
* <!-- begin-user-doc -->
* Return the names of all teams -
* Sample home method
* <!-- end-user-doc -->
* @ejb.home-method
*/
public String[] ejbHomeGetTeamNames() throws EJBException
{
try {
Collection items = this.ejbSelectTeamNames();
String[] ret = (String[])items.toArray(new String[0]);
return ret;
}
catch(FinderException ex) {
throw new EJBException(ex);
}
}
/**
*
* @ejb.select
* query="SELECT DISTINCT team.teamName FROM MlbTeam AS team"
* result-type-mapping="Local"
*/
public abstract Collection ejbSelectTeamNames()
throws FinderException;
WHen I run i get an error saying t0_a.teamname does not exist
I am running as a home method
I have also tried
SELECT team.teamName FROM MlbTeam AS team
and
SELECT team.teamName FROM MlbTeam team
What am I doing wrong??????
Technical Details
Message-ID:
<973f4e2c.0408121459.797aefaf@posting.google.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!postnews2.google.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 1044d3,fbb5a106538924e7,start X-Google-Thread: fcfbb,fbb5a106538924e7,start X-Google-Thread: 10a146,fbb5a106538924e7,start X-Google-Thread: f7ed6,fbb5a106538924e7,start X-Google-Attributes: gid1044d3,gidfcfbb,gid10a146,gidf7ed6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews2.google.com!not-for-mail From: smlewis@lordjoe.com (Steve Lewis) Newsgroups: weblogic.developer.interest.ejb.cmp,comp.lang.java.beans,comp.lang.java.programmer,borland.public.jbuilder.enterprise Subject: need help with ejbSelect returning all instances of a field Date: 12 Aug 2004 15:59:37 -0700 Organization: http://groups.google.com Lines: 51 Message-ID: <973f4e2c.0408121459.797aefaf@posting.google.com> NNTP-Posting-Host: 207.202.172.229 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1092351577 27431 127.0.0.1 (12 Aug 2004 22:59:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 12 Aug 2004 22:59:37 +0000 (UTC)