Jason -

Sorry, try the following property[1] .... looks like I had you try the
wrong value for this prop before(sorry). I'll try to load postgres up on my
machine this afternoon if it doesn't work.

Thanks,
Rick

[1] <property name="openjpa.jdbc.DBDictionary"
value="postgres(supportsDelimitedIdentifiers=true)" />

On Fri, Apr 27, 2012 at 11:23 AM, Jason <jdr0...@renci.org> wrote:

> Rick,
>
> I have an application that sits on top of a Karaf container.  One of my
> maven projects is an osgi bundle which deploys a datasource as a service.
>  I, then, have the following in the persistence.xml file to get that
> datasource:
>
> <jta-data-source>aries:**services/javax.sql.DataSource/**(
> osgi.jndi.service.name=jdbc/**mapseqJTA)</jta-data-source>
> <non-jta-data-source>aries:**services/javax.sql.DataSource/**(
> osgi.jndi.service.name=jdbc/**mapseqNoJTA)</non-jta-data-**source>
>
>
> For my test cases, I have a different persistence.xml file, which has the
> following properties:
>
>      <property name="openjpa.**ConnectionDriverName"
> value="org.postgresql.Driver" />
>
>      <property name="openjpa.ConnectionURL" 
> value="jdbc:postgresql://**localhost:5432/mapseq"
> />
>
>      <property name="openjpa.**ConnectionUserName" value="xxxxx" />
>
>      <property name="openjpa.**ConnectionPassword" value="xxxxx" />
>
>
>      <property name="openjpa.jdbc.**MappingDefaults"
> value="ForeignKeyDeleteAction=**restrict, 
> JoinForeignKeyDeleteAction=**restrict"
> />
>
>      <property name="openjpa.jdbc.**SynchronizeMappings"
> value="buildSchema(**ForeignKeys=true)" />
>
>      <property name="openjpa.Log" value="DefaultLevel=TRACE,
> Runtime=TRACE, Tool=TRACE, SQL=TRACE" />
>
>
>      <property name="openjpa.jdbc.**DBDictionary" value="postgres" />
>
>      <property name="openjpa.DataCache" value="false" />
>
>      <property name="openjpa.QueryCache" value="false" />
>
>
>
>
>
> On 04/27/2012 11:50 AM, Rick Curtis wrote:
>
>> How are you configuring your database connection?
>>
>> On Fri, Apr 27, 2012 at 10:46 AM, Jason<jdr0...@renci.org>  wrote:
>>
>>  Rick,
>>>
>>> Here are my properties:
>>>
>>>      <property name="openjpa.jdbc.****MappingDefaults"
>>> value="ForeignKeyDeleteAction=****restrict,
>>> JoinForeignKeyDeleteAction=****restrict"
>>>
>>> />
>>>
>>>      <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO,
>>> Tool=INFO, SQL=WARN" />
>>>
>>>      <property name="openjpa.jdbc.****DBDictionary" value="postgres" />
>>>
>>>
>>>      <property name="openjpa.DataCache" value="true" />
>>>
>>>      <property name="openjpa.QueryCache" value="true" />
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 04/27/2012 11:39 AM, Rick Curtis wrote:
>>>
>>>  Jason -
>>>>
>>>> What do you have set for properties in your persistence.xml file?
>>>>
>>>> Thanks,
>>>> Rick
>>>>
>>>> On Fri, Apr 27, 2012 at 9:52 AM, Jason<jdr0...@renci.org>   wrote:
>>>>
>>>>  Rick,
>>>>
>>>>> When I set that property, I get the following build time error:
>>>>>
>>>>> [ERROR] Failed to execute goal org.codehaus.mojo:openjpa-****
>>>>>
>>>>> maven-plugin:1.2:sql
>>>>>
>>>>> (enhancer) on project mapseq-dao-api: Execution enhancer of goal
>>>>> org.codehaus.mojo:openjpa-******maven-plugin:1.2:sql failed:
>>>>> org.apache.openjpa.jdbc.sql.******PostgresDictionary@4896b555.******
>>>>> supportsDelimitedIdentifiers
>>>>> = false: java.sql.DatabaseMetaData.<******init>(java.lang.String) ->
>>>>> [Help 1]
>>>>>
>>>>> org.apache.maven.lifecycle.******LifecycleExecutionException: Failed
>>>>> to
>>>>> execute goal org.codehaus.mojo:openjpa-******maven-plugin:1.2:sql
>>>>>
>>>>> (enhancer)
>>>>>
>>>>> on project mapseq-dao-api: Execution enhancer of goal
>>>>> org.codehaus.mojo:openjpa-******maven-plugin:1.2:sql failed:
>>>>> org.apache.openjpa.jdbc.sql.******PostgresDictionary@4896b555.******
>>>>>
>>>>> supportsDelimitedIdentifiers
>>>>>
>>>>> = false
>>>>>
>>>>>
>>>>>
>>>>> The root cause far down the stacktrace is:
>>>>>
>>>>> Caused by: java.lang.******NoSuchMethodException:
>>>>> java.sql.DatabaseMetaData.<*
>>>>> *init>(java.lang.String)
>>>>>
>>>>>    at java.lang.Class.******getConstructor0(Class.java:******2723)
>>>>>
>>>>>    at java.lang.Class.******getConstructor(Class.java:******1674)
>>>>>
>>>>>    at org.apache.openjpa.lib.util.******Options.stringToObject(**
>>>>>
>>>>>
>>>>> Options.java:437)
>>>>>
>>>>>
>>>>> I did try to upgrade from OpenJPA v2.1.1 to v2.2.0, but got the same
>>>>> error.  Any other suggestions?
>>>>>
>>>>> Thanks,
>>>>> Jason
>>>>>
>>>>>
>>>>> On 04/26/2012 03:38 PM, Rick Curtis wrote:
>>>>>
>>>>>  Jason --
>>>>>
>>>>>> I'm able to recreate your failure when running against MySQL and a
>>>>>> hacked
>>>>>> up runtime. Can you try running with the following property[1] set ?
>>>>>>
>>>>>> Thanks,
>>>>>> Rick
>>>>>>
>>>>>> [1]<property name="openjpa.jdbc.******DBDictionary"
>>>>>> value="postgres(******supportsDelimitedIdentifiers=******false)"/>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Thu, Apr 26, 2012 at 10:03 AM, Jason<jdr0...@renci.org>    wrote:
>>>>>>
>>>>>>  Rick,
>>>>>>
>>>>>>  If I wrap the reserved word in quotes (\"...\"), then the column is
>>>>>>> created correctly.  Here is the generated create table sql:
>>>>>>>
>>>>>>> CREATE TABLE xxx (guid BIGINT NOT NULL, approved BOOL, "grant"
>>>>>>> VARCHAR(64), PRIMARY KEY (guid));
>>>>>>>
>>>>>>> Yet, when I try to persist to that table, OpenJPA runs an "alter
>>>>>>> table"
>>>>>>> command.  Since the column already exists, an exception is thrown.
>>>>>>>
>>>>>>> org.apache.openjpa.********persistence.********PersistenceException:
>>>>>>>
>>>>>>> ERROR:
>>>>>>>
>>>>>>> column
>>>>>>>
>>>>>>> "grant" of relation "xxx" already exists {stmnt 726853985 ALTER TABLE
>>>>>>> study
>>>>>>> ADD "grant" VARCHAR(64)} [code=0, state=42701]
>>>>>>>    at org.apache.openjpa.jdbc.meta.********MappingTool.record(**
>>>>>>> MappingTool.java:558)
>>>>>>>    at org.apache.openjpa.jdbc.meta.********MappingTool.record(**
>>>>>>> MappingTool.java:456)
>>>>>>>    at org.apache.openjpa.jdbc.********kernel.JDBCBrokerFactory.**
>>>>>>> synchronizeMappings(********JDBCBrokerFactory.java:160)
>>>>>>>    at org.apache.openjpa.jdbc.********kernel.JDBCBrokerFactory.**
>>>>>>> synchronizeMappings(********JDBCBrokerFactory.java:164)
>>>>>>>    at org.apache.openjpa.jdbc.********kernel.JDBCBrokerFactory.****
>>>>>>> newBrokerImpl(*
>>>>>>> *JDBCBrokerFactory.java:122)
>>>>>>>    at org.apache.openjpa.kernel.********AbstractBrokerFactory.****
>>>>>>> newBroker(**
>>>>>>> AbstractBrokerFactory.java:********210)
>>>>>>>    at org.apache.openjpa.kernel.********DelegatingBrokerFactory.****
>>>>>>> newBroker(**
>>>>>>> DelegatingBrokerFactory.java:********156)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>> Jason
>>>>>>>
>>>>>>>
>>>>>>> On 04/25/2012 02:28 PM, Rick Curtis wrote:
>>>>>>>
>>>>>>>  Hmm, that is a super old JIRA. I would expect that this should work.
>>>>>>>
>>>>>>>  Your
>>>>>>>> original post said that the exception happens when creating
>>>>>>>> tables...
>>>>>>>> what
>>>>>>>> happens if you create the tables by hand and delimit this table name
>>>>>>>> via
>>>>>>>> annotations (via \"...\")? Does the manual delimiter work at
>>>>>>>> runtime?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Rick
>>>>>>>>
>>>>>>>> On Wed, Apr 25, 2012 at 11:55 AM, Jason<jdr0...@renci.org>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>  Rick,
>>>>>>>>
>>>>>>>>  I am using OpenJPA v2.1.1.
>>>>>>>>
>>>>>>>>> I did find this open bug related to the issue:
>>>>>>>>> https://issues.apache.
>>>>>>>>> **
>>>>>>>>> org/*<https://issues.apache.******org/*<https://issues.apache.**
>>>>>>>>> **org/*<https://issues.apache.**org/*<https://issues.apache.org/*>
>>>>>>>>> >
>>>>>>>>> *jira/browse/OPENJPA-84<https:********//issues.apache.org/**
>>>>>>>>> jira/**** <http://issues.apache.org/jira/****><http://issues.**
>>>>>>>>> apache.org/jira/** <http://issues.apache.org/jira/**>>
>>>>>>>>>
>>>>>>>>> browse/OPENJPA-84<https://****is**sues.apache.org/jira/**
>>>>>>>>> browse/**** <http://sues.apache.org/jira/browse/****>
>>>>>>>>> OPENJPA-84<http://issues.**apache.org/jira/browse/****OPENJPA-84<http://issues.apache.org/jira/browse/**OPENJPA-84>
>>>>>>>>> ><
>>>>>>>>> https://issues.**apache.org/**jira/browse/**OPENJPA-84<http://apache.org/jira/browse/**OPENJPA-84>
>>>>>>>>> <https**://issues.apache.org/jira/**browse/OPENJPA-84<https://issues.apache.org/jira/browse/OPENJPA-84>
>>>>>>>>> >
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> After reading that bug, I figured that I will have to change the
>>>>>>>>> name
>>>>>>>>> of
>>>>>>>>> the column to not be a reserved word until this bug is
>>>>>>>>> implemented/fixed.
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Jason
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 04/25/2012 10:01 AM, Rick Curtis wrote:
>>>>>>>>>
>>>>>>>>>  Jason -
>>>>>>>>>
>>>>>>>>>  What version of OpenJPA are you running? Can you post the full
>>>>>>>>>
>>>>>>>>>> stacktrace?
>>>>>>>>>>
>>>>>>>>>> On Tue, Apr 24, 2012 at 11:56 AM, Jason<jdr0...@renci.org>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>  Hi all,
>>>>>>>>>>
>>>>>>>>>>  I am using OpenJPA with PostgreSQL.  I have a table where a
>>>>>>>>>> column
>>>>>>>>>>
>>>>>>>>>>  has
>>>>>>>>>>> the
>>>>>>>>>>> name of "grant".  How can I get the schema creation routine to
>>>>>>>>>>> wrap
>>>>>>>>>>> the
>>>>>>>>>>> column name "grant" in quotes?  Changing the column name is
>>>>>>>>>>> doable,
>>>>>>>>>>> but
>>>>>>>>>>> not
>>>>>>>>>>> preferable.
>>>>>>>>>>>
>>>>>>>>>>> I have tried the brain dead solution of just using: @Column(name
>>>>>>>>>>> =
>>>>>>>>>>> "\"grant\"")
>>>>>>>>>>>
>>>>>>>>>>> But that results in an error...PersistenceException: column
>>>>>>>>>>> already
>>>>>>>>>>> exists.
>>>>>>>>>>>
>>>>>>>>>>> Any suggestions?
>>>>>>>>>>>
>>>>>>>>>>> Regards,
>>>>>>>>>>> Jason
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>
>


-- 
*Rick Curtis*

Reply via email to