EJB QL select method

Hi,

Can somebody please explain how the SELECT method is supposed to work. I've been searching the net for about an hour and can't find a good example.

I have this method in the deployment descriptor to count the number of objects in the database:

<query>

<query-method>

<method-name>ejbSelectTripCount</method-name>

<method-params/>

</query-method>

<ejb-ql>

SELECT COUNT(t)

FROM Trip AS t

</ejb-ql>

</query>

But as I understand it this method cannot go in the Remote Interface and has to go in the bean implementation:

publicabstractclass TripBeanimplements javax.ejb.EntityBean{

...

publicabstractint ejbSelectTripCount()throws FinderException;

...}

How do I call this method without first finding a bean reference (there may not be any), and why is it implemented this way?

thanks in advance for your help,

Stu.

[1320 byte] By [_DuRdEn_a] at [2007-10-3 4:53:05]
# 1
ejbSelect() methods are not exposed to the client. You must expose a method yourself, say getTripCount() and return the result of ejbSelectTripCount() from there.Brian
brian@cubik.caa at 2007-7-14 22:57:55 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

> Hi,

> Can somebody please explain how the SELECT method

> is supposed to work. I've been searching the net

> for about an hour and can't find a good example.

>

> I have this method in the deployment descriptor to

> count the number of objects in the database:

>

> <query>

> <query-method>

> <method-name>ejbSelectTripCount</method-name>

> <method-params/>

> </query-method>

>

> <ejb-ql>

> SELECT COUNT(t)

> FROM Trip AS t

> </ejb-ql>

> </query>

>

>

> But as I understand it this method cannot go in the

> Remote Interface and has to go in the bean

> implementation:

>

> public abstract class TripBean implements

> javax.ejb.EntityBean{

> ...

> public abstract int ejbSelectTripCount() throws

> FinderException;

> ...}

>

> How do I call this method without first finding a

> bean reference (there may not be any), and why is it

> implemented this way?

>

> thanks in advance for your help,

>

> Stu.

You cant do it, buy implementing a home method and exposing it in the home interface.

public int ejbHomeGetTripCount()

Fil

fmagrini72a at 2007-7-14 22:57:55 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...