I am having a problem with my ORMLite package. When I create the schema for the table, I thought it would be good practice to avoid all entity names. This will protect some Java class or field name from the SQL reserved word:
CREATE TABLE "footable" ("stuff" VARCHAR(255))
Now I am adding raw query support so that ORMLite can help users complete their own queries. However, I find that with Derby and Hsqldb, object names cannot be used without escaping. For example, the following query:
SELECT * FROM footable
generates the following errors:
Derby: ERROR 42X05: Table/View 'FOOTABLE' does not exist. Hsqldb: Table not found in statement [select * from footable]
It works fine if the selection table is also escaped as "footable" . Other databases supported by ORMLite work fine with or without screens: MySQL, Postgres, Microsoft SQL Server, H2, and Sqlite.
Are there any better ways to avoid reserved words in Derby and Hsqldb? Other ideas on how to do this in a portable way?
Thanks.
source share