persistence@glassfish.java.net

Re: How to change SQL-statements for Persistence Unit

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Thu, 16 Mar 2006 23:50:18 -0800

Did you specify any platform in you persistence.xml? The code tries to
autodetect the database type, but if you specify it explicitly, your
value will be used instead.

You can create the tables yourself, and do not rely on the automatic
table creation.

Regards,
-marina

Дмитрий Можейко wrote:
> I create JDBC-resource for PostgreSQL on GlassFish.
> And try to deploy ejb3 sample from netbeans site (http://www.netbeans.org/kb/55/ejb3-preview.html).
> I give errors:
>
> ...
> JDO76609: Got SQLException executing statement "CREATE TABLE CUST_ORDER (ID NUMBER(19) NOT NULL, DUEDATE TIMESTAMP, CUSTOMER VARCHAR, PRIMARY KEY (ID))": org.postgresql.util.PSQLException: ERROR: syntax error near "("
> JDO76609: Got SQLException executing statement "CREATE TABLE ORDER_ITEM (ID NUMBER(19) NOT NULL, ITEM_ID NUMBER(19) NOT NULL, PRIMARY KEY (ID, ITEM_ID))": org.postgresql.util.PSQLException: ERROR: syntax error near "("
> JDO76609: Got SQLException executing statement "CREATE TABLE ITEM (ITEM_ID NUMBER(19) NOT NULL, DESCRIPTION VARCHAR, PRIMARY KEY (ITEM_ID))": org.postgresql.util.PSQLException: ERROR: syntax error near "("
> JDO76609: Got SQLException executing statement "CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50), SEQ_COUNT NUMBER(19))": org.postgresql.util.PSQLException: ERROR: syntax error near "("
> JDO76609: Got SQLException executing statement "INSERT INTO SEQUENCE(SEQ_NAME, SEQ_COUNT) values ('SEQ_GEN', 0)": org.postgresql.util.PSQLException: ERROR: relation "sequence" does not exists
>
>
> How i can change create-table-statements, sql-jdbc-mappings and others sql-options for persistence unit?