Re: [JBoss-user] findByHighestValue
On Wednesday, October 1, 2003, at 11:36 PM, Milen Dyankov wrote: Matthew Hixson wrote: 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: findAll 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@ 10x M@, I could actually go ahead and use JBossQL rather than EJB-QL. The thing is that my manager wouldn't like that. We are supposed to write code that is easy to move to another application server when and if there is such need. I do not have experience with other servers. If most of them have own QL, at least as powerful as JBossQL, than I could try to push the idea of using JBoss-QL. I think a lot of people have found vanilla EJB-QL to be lacking so many needed features (such as order by) that nearly everyone is using an application server specific query syntax. I'd say 9 out of 10 of my finders make use of JBossQL. We just migrated our webapp from Resin to JBoss. Both of them extend EJB-QL. So its not impossible to move from one application server to another. -M@ --- 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
Re: [JBoss-user] findByHighestValue
Matthew Hixson wrote: 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: findAll 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@ 10x M@, I could actually go ahead and use JBossQL rather than EJB-QL. The thing is that my manager wouldn't like that. We are supposed to write code that is easy to move to another application server when and if there is such need. I do not have experience with other servers. If most of them have own QL, at least as powerful as JBossQL, than I could try to push the idea of using JBoss-QL. 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
Re: [JBoss-user] findByHighestValue
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: findAll 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: "," ... ) ... == 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
Re: [JBoss-user] findByHighestValue
You need to use JBossQL instead of EJBQL. alex 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: "," ... ) ... == 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
Re: [JBoss-user] findByHighestValue
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: "," ... ) ... == 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
Re: [JBoss-user] findByHighestValue
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@ --- 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
Re: [JBoss-user] findByHighestValue
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. 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
Re: [JBoss-user] findByHighestValue
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@ On Monday, September 29, 2003, at 02:39 AM, Milen Dyankov wrote: Hi all, Is there a way to find CMP by highest/lowest value of given field? Say something like: findLastDelivery(); // ... where ddate = SELECT max (ddate) ... findBiggestOrder(); // ... where amount = SELECT max (amount) ... It looks like it can not be done with EJB-QL. Should I go for SLSB + JDBC for this? 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
Re: [JBoss-user] findByHighestValue
Unfortunately, it is not supported by JBossQL at the moment. I'll look into adding them. alex Milen Dyankov wrote: Hi all, Is there a way to find CMP by highest/lowest value of given field? Say something like: findLastDelivery(); // ... where ddate = SELECT max (ddate) ... findBiggestOrder(); // ... where amount = SELECT max (amount) ... It looks like it can not be done with EJB-QL. Should I go for SLSB + JDBC for this? 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
[JBoss-user] findByHighestValue
Hi all, Is there a way to find CMP by highest/lowest value of given field? Say something like: findLastDelivery(); // ... where ddate = SELECT max (ddate) ... findBiggestOrder(); // ... where amount = SELECT max (amount) ... It looks like it can not be done with EJB-QL. Should I go for SLSB + JDBC for this? 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