J Cameron Cooper wrote:

....

I can't say, but here's a clip from one of my attempts at doing something similar for JBoss 3.2.3. It deploys fine. But beware of thinking that it's necessarily right: I cannot run this where the database's summation results are anything other than NULL without getting a mysterious ClassCastException. Still trying to figure that out -- and if anyone has any suggestions, I'd be very grateful.

Turns out that JBossQL queries only return Doubles for this sort of thing.


http://sourceforge.net/tracker/?func=detail&aid=794199&group_id=22866&atid=381174

(Though I swear I tried that before and it didn't work.) For the record, here's some actual working code::

// up in the class level xdoclet declarations...

* @jboss.query signature="java.lang.Double ejbSelectRainfallSumByTypeAndWatershedAndTimeRange(java.lang.Integer t, java.lang.String w, java.lang.Long a, java.lang.Long z)"
* query="SELECT SUM(r.rainfall) FROM Rainfall AS r WHERE r.type=?1 AND r.watershedId = ?2 AND r.time >= ?3 AND r.time < ?4"


// ...

/**
* An EJB select method for a sum of rainfall over a period of
* time. Since our Jboss doesn't support EJB2.1 where the SUM is
* added to EJB-QL, we'll over-ride with Jboss-QL for the moment.
*
* @ejb.select query="SELECT SUM(r.rainfall) FROM Rainfall AS r WHERE r.type=?1 AND r.watershedId = ?2 AND r.time >= ?3 AND r.time < ?4"
* result-type-mapping="Remote"
*/
public abstract Double ejbSelectRainfallSumByTypeAndWatershedAndTimeRange(Integer t, String w, Long a, Long z) throws FinderException;


/**
* Home method to use the
* ejbSelectRainfallSumByTypeAndWatershedAndTimeRange method that
* returns the sum, since it cannot be used directly.
*
* @ejb.home-method view-type="remote"
*/
public Double ejbHomeGetRainfallSumOverTime(Integer t, String w, Long a, Long z) throws FinderException {
return ejbSelectRainfallSumByTypeAndWatershedAndTimeRange(t, w, a, z);
}



--jcc


--
"He who fights with monsters should look to it that he himself does not become a monster. 
And when you gaze long into an abyss the abyss also gazes into you."




------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to