need help with ejbSelect returning all instances of a field

S

Steve Lewis

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??????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top