users@glassfish.java.net

SQLSyntaxException

From: <glassfish_at_javadesktop.org>
Date: Wed, 20 Aug 2008 02:04:43 PDT

Hi,
I'm doing the custom database tutorial at http://www.netbeans.org/kb/61/java/gui-db-custom.html, and I've run into a SQL Syntax Error. This doesn't occur until i'm running the app.

[TopLink Warning]: 2008.08.20 03:10:16.498--ServerSession(9578500)--Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException:
Column 'PRODUCTID' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'PRODUCTID' is not a column in the target table.
Error Code: -1
Call: SELECT ID, PRODUCTID, QUANTITY, ORDER_DATE, CUSTOMER_ID FROM MCALEX.ORDERS WHERE (CUSTOMER_ID = ?)
bind => [1]
Query: ReadAllQuery(customerrecords.Orders)
Exception in thread "AWT-EventQueue-0" Local Exception Stack:

The column the error talks about - PRODUCTID - has been named PRODUCT_ID everywhere in the database. I don't know why toplink thinks the column is named PRODUCTID, and (worse) I don't know where to change the code so the call is SELECT ID, PRODUCT_ID, QUANTITY, etc etc. I've done a search for text within files, but cannot find the incorrect Call: anywhere.

I've done everything according to the tutorial, with the exception of running the database on Derby, not MySql. Testing the app works right up til the last step, after disabling editing in the main table, so i don't think the error is in using derby per se, but maybe something I need to set up to tell derby that the column is PRODUCT_ID (but why would it only get that column wrong).

Any help? I'm about to rip everything out and start again, so I'll be about 4 work-hours happier if anyone knows what I've done wrong.

Many thanks

mcalex
[Message sent by forum member 'mcalex' (mcalex)]

http://forums.java.net/jive/thread.jspa?messageID=294312