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