On 5/16/05, Eric Anderson <[EMAIL PROTECTED]> wrote:
> What is the correct syntax? I tried the following
> 
> SELECT p FROM org.usiis.struts.PatientSearchForm p LIMIT $1 ORDER BY
> p.lastName
> 
> but got
> 
> org.exolab.castor.jdo.oql.OQLSyntaxException: An incorrect token type
> was found
> near ORDER (found KEYWORD_ORDER, but expected END_OF_QUERY)

Eric, 

This is because the statement is not structured correctly. Try
following the example in the release notes
(http://castor.codehaus.org/release-notes.html). Please notice that I
had to fix the example slightly:

    select a from Account a order by a.id limit $1 offset $2

Notice that the LIMIT (and OFFSET if you decide to use it) must come
after the ORDER BY clause.

I didn't actually write this code and I don't have access to Oracle at
this time. It can also be helpful if you could enable the following
property in the castor.properties file:

# True if proxy classes should be used for JDBC connections and 
# prepared statements (default: true).
#
org.exolab.castor.persist.useProxies=true

This property will cause Castor to use proxy objects for
PreparedStatements which will output a large amount of debug output
including the actual SQL statements being generated by Castor. Of
course, you'll also need to enable Log4J debug level logging for the
This feature is only available in Castor 0.9.6.

Bruce 
-- 
perl -e 'print unpack("u30","D0G)[EMAIL 
PROTECTED]&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

The Castor Project
http://www.castor.org/

Apache Geronimo
http://geronimo.apache.org/

Reply via email to