Hi,

I just want to do the same thing (the MAX value for the primary key on a
Bean CMP context).
Has anybody solve this problem ?

-----Message d'origine-----
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]De la part de Richard
Taylor
Envoye : jeudi 22 mars 2001 13:06
A : [EMAIL PROTECTED]
Objet : [JBoss-user] Problem with SQL MAX() function in jaws.xml finder


I cannot get the MAX() function to work within a finder.

Environment: NT 4.0, jBoss 2.1-beta with tomcat

Here's my jaws.xml file:
<jaws>
 <enterprise-beans>
  <entity>
   <ejb-name>CustomerBean</ejb-name>
   <finder>
    <name>findNewest</name>
    <query>(key = (SELECT MAX(key) FROM CustomerBean))</query>
<!--
    <query>key = (SELECT COUNT(*) FROM CustomerBean)</query>
-->
    <order></order>
   </finder>
  </entity>
 </enterprise-beans>
</jaws>

Here's the result:
[JAWS] java.sql.SQLException: Column not found: KEY in statement [SELECT
key FROM CustomerBean WHERE (key = (SELECT MAX(key) FROM CustomerBean))]

If, however, I use  COUNT(*) instead (commented out above) I get a
sensible result. Its the MAX(key) that upsets jBoss.

Is this a JAWS bug?
If so, is there a work-around. I would prefer not to embed my SQL.

Thanks in advance...


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to