Sorry, I should have said JBossQL rather than EJB-QL. If you're not using xdoclet you can specify a JBossQL query in jbosscmp-jdbc.xml like so:

<query>
<description><![CDATA[find all content in an invoice]]></description>
<query-method>
<method-name>findAll</method-name>
<method-params>
</method-params>
</query-method>
<jboss-ql><![CDATA[select object(o) from v_invoice_contents as o order by o.invoiceContentId]]></jboss-ql>
</query>


If you are using xdoclet specify this in your bean:

* @ejb.finder
* signature="java.util.Collection findAll()"
* query="select object(o) from v_invoice_contents as o order by o.invoiceContentId"
* @jboss.query
* description="find all content in an invoice"
* signature="java.util.Collection findAll()"
* query="select object(o) from v_invoice_contents as o order by o.invoiceContentId"


-M@

On Wednesday, October 1, 2003, at 01:11 AM, Milen Dyankov wrote:

Matthew Hixson wrote:
On Tuesday, September 30, 2003, at 12:30 AM, Milen Dyankov wrote:

Matthew Hixson wrote:


Could you do something like this for findLastDelivery:
select ddate from foo where bar=?1 order by ddate desc limit 1
You could do pretty much the same thing for finding the biggest order too.
-M@



Yes I can do that. But that is still SQL query that can not be rewritten in EJB-QL. My point was that one can not make use of CMPs for doing this.
I think a EJB-QL finder like this will work with JBoss.
select object(o) from table_name o order by o.ddate desc limit 1
Have you tried it?
  -M@

Yes I have. This is what I have got:
==================================================
...
org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "ORDER" at line 1, column 34.
Was expecting one of:
<EOF>
"," ...
)
...
==================================================


May be I got it wrong, but as far as I remember there was nothing about
"ORDER BY" or "LIMIT" in EJB-QL docs.

Moreover, part of our application uses "PervasiveSQL" and there is no
equivalent of MySQL's "LIMIT" or MSSQL's "TOP".


Best regards, Milen Dyankov



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user




------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to