You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by colorado_flyer <ch...@parallelsw.com> on 2010/06/30 09:06:08 UTC

problem with reserved words

Hi all,

I'm converting a legacy system into JPA and ran across this issue.  I looked
for a resolution, and found some talk about the issue, but did not see any
resolution so I thought I would post and see how I can fix this.

I'm converting into OpenJPA 2.0.0, using a legacy system so I can't change
the db.

One of the tables has a column named "PRIMARY" which is listed in the
invalidColumnWordSet (using PostgresQL).

I'm not sure where things go wrong here, but the MappingInfo(line 683) class
recognizes the column as being reserved.  It then invokes a method
'getValidColumnName' (MappingInfo line 684) which returns a name "PRIMARY0". 
Next it goes out to the table and looks for a column in the table with a
name of PRIMARY0 which is not found and a MegaDataException is then thrown.

Has anyone run across this issue and fixed it?  I'm hoping there is some
work around for this, as I'm sure it will be the same issue for any words in
the invalidColumnWordSet for any of the DBDictionary(s) out there.

tia,
-chris
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/problem-with-reserved-words-tp5237335p5237335.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: problem with reserved words

Posted by colorado_flyer <ch...@parallelsw.com>.
Hi Rick,

Thank you for the reply, I just got the code back into working order, and
your solution worked!

-chris 
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/problem-with-reserved-words-tp5237335p5319760.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: problem with reserved words

Posted by Rick Curtis <cu...@gmail.com>.
Have you tried to something like @Table(name="\"PRIMARY\"") ?

Thanks,
Rick

On Wed, Jun 30, 2010 at 2:06 AM, colorado_flyer <ch...@parallelsw.com>wrote:

>
> Hi all,
>
> I'm converting a legacy system into JPA and ran across this issue.  I
> looked
> for a resolution, and found some talk about the issue, but did not see any
> resolution so I thought I would post and see how I can fix this.
>
> I'm converting into OpenJPA 2.0.0, using a legacy system so I can't change
> the db.
>
> One of the tables has a column named "PRIMARY" which is listed in the
> invalidColumnWordSet (using PostgresQL).
>
> I'm not sure where things go wrong here, but the MappingInfo(line 683)
> class
> recognizes the column as being reserved.  It then invokes a method
> 'getValidColumnName' (MappingInfo line 684) which returns a name
> "PRIMARY0".
> Next it goes out to the table and looks for a column in the table with a
> name of PRIMARY0 which is not found and a MegaDataException is then thrown.
>
> Has anyone run across this issue and fixed it?  I'm hoping there is some
> work around for this, as I'm sure it will be the same issue for any words
> in
> the invalidColumnWordSet for any of the DBDictionary(s) out there.
>
> tia,
> -chris
>