persistence@glassfish.java.net

Re: How to change SQL-statements for Persistence Unit

From: Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM>
Date: Fri, 17 Mar 2006 17:49:48 +0530

Dmitry Mozheyko wrote:

>>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.
>>
>>
>
>Where i can find docs, examples about this file?
>
>
https://glassfish.dev.java.net/javaee5/persistence/entity-persistence-support.html#persistence.xml

Can you send contents of your persistence.xml? Ideally, you don't have
to use any special property to inform the runtime that you are using
Postgress. It should be automatically detected for you.

Thanks,
Sahoo

>
>
>>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?
>>>
>>>