Welcome Guest  |  Register  |  Login
Login Name Password
  Search  
  Index  | Recent Threads  | Unanswered Threads  | Who's Online  | Help


Quick Go »

No member browsing this thread
Thread Status: Active
Total posts in this thread: 2
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 1240 times and has 1 reply Next Thread
Male dw
Newbie




Joined: Oct 3, 2007
Post Count: 13
Status: Offline
Reply to this Post  Reply with Quote 
JDOUserException: SQL statement doesnt start with SELECT

Hi!

Using DataNucleus 1.1.2.

I have this named query defined in package.jdo:


<query
name="MagazinesByObjectId"
language="javax.jdo.query.SQL"
result-class="Magazine"><![CDATA[
SELECT
objekt_id,
ausgabe_id,
hbv_objekt_nr,
vkznr,
objekt_langtext,
verlag_kurzname,
vertrieb_kurzname
FROM objekt_daten
WHERE
objekt_id >= ?
AND
objekt_id < ?
]]></query>


When using this query an execption is thrown although I can't find anything being wrong with the SQL statement:


You have specified an SQL statement ("SELECT
objekt_id,
ausgabe_id,
hbv_objekt_nr,
vkznr,
objekt_langtext,
verlag_kurzname,
vertrieb_kurzname
FROM objekt_daten
WHERE
objekt_id >= ?
AND
objekt_id < ?") that doesnt start with SELECT. This is invalid.
org.datanucleus.exceptions.NucleusUserException: You have specified an SQL statement ("SELECT
objekt_id,
ausgabe_id,
hbv_objekt_nr,
vkznr,
objekt_langtext,
verlag_kurzname,
vertrieb_kurzname
FROM objekt_daten
WHERE
objekt_id >= ?
AND
objekt_id < ?") that doesnt start with SELECT. This is invalid.
at org.datanucleus.store.rdbms.query.SQLQuery.<init>(SQLQuery.java:151)


It turned out that the SELECT keyword must not be followed by a line break character (0x0D or 0x0A) like in the package.jdo code above but by a different whitespace character (e.g. 0x20 or 0x09).

Inserting a space after SELECT and before the line break works. Maybe someone will find that useful.

In the JDO 2.2 spec I can't find any constraint on the whitespace characters that must follow SELECT. Is this in compliance with the SQL spec or should this be reported a bug?

Dirk
[Apr 21, 2009 3:31:04 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male andy
Expert
Member's Avatar

UK
Joined: Mar 13, 2004
Post Count: 5686
Status: Offline
Reply to this Post  Reply with Quote 
Re: JDOUserException: SQL statement doesnt start with SELECT

Likely there's a check on
SELECT
(trailing space) on the assumption that people have more than 20 character width these days wink. Raise a JIRA on "NUCRDBMS" as Minor. Thx!
----------------------------------------
-Andy smile

[Apr 21, 2009 3:54:45 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread