> and the JPA spec mandates how field and column names are converted by 
> default. 

Dumb Spec! :-)

> the second part is why OpenJPA isn't doing any conversion of the columns
> automatically. There is an option that will turn on the renaming.

Would you enlighten us what that option is?  Looked but couldn't anything in 
User's Guide.. sorry.

> OpenJPA is not properly escaping reserved words
> The first part is the salient bug

Not sure I understand this one; if it's a reserved word on some DB, you can't 
"escape" it to create a table or column named like the reserved word, can you?  
I'm probably missing your point. - Not important, I'm assuming the option you 
mention will do what I want.  (Bug if 'it' is a bug, have it in your JIRA 
already?)

Thanks!


-----Original Message-----
From: Patrick Linskey [mailto:[EMAIL PROTECTED]
Sent: Fri 1/18/2008 9:56 AM
To: [email protected]
Subject: Re: Reserved keywords mechanism working?
 
> Hello there again! ;-)

Hello!

> Is that "Reserved keywords mechanism" in the DBDictionary stuff maybe
> broken, or am I dumb or missing something obvious?

The problem is twofold: OpenJPA is not properly escaping reserved
words, and the JPA spec mandates how field and column names are
converted by default. The first part is the salient bug; the second
part is why OpenJPA isn't doing any conversion of the columns
automatically. There is an option that will turn on the renaming.

-Patrick

On Jan 17, 2008 11:15 AM, Michael Vorburger
<[EMAIL PROTECTED]> wrote:
> Hello there again! ;-)
>
> Is that "Reserved keywords mechanism" in the DBDictionary stuff maybe
> broken, or am I dumb or missing something obvious?
>
> With OpenJPA 1.0.1, if I take the examples/hellojpa, which runs fine
> unmodified, and add a "@Basic private String group;" to the
> Message.java, you get the copy/pasted error below. As if something was
> wrong with the reservedWords mechanism in the DBDictionary which reads
> sql-keywords.rsrc and extends the list in e.g. DerbyDictionary? The
> correct dictionary DOES appear to be in use, according to the log below.
>
> The problem doesn't seem to be limited to Derby; I initially played
> around on a Sybase, and there again (another) keyword listed in the
> sql-keywords.rsrc isn't picked up.
>
> An aside, may be separate or may be related: On same Sybase I'm also
> getting e.g. "org.apache.openjpa.lib.jdbc.ReportingSQLException: The
> identifier that starts with 'effectiveMarketSegmentCheckedF' is too
> long. Maximum length is 30." problems - despite the SybaseDictionary
> having a maxColumnNameLength = 30. Do I have to "activate" anything?
>
> Am I missing something? This stuff is supposed to work "out of the box",
> I would have thought? Any ideas?
>
> Regards and thanks,
> Michael
>
> _____________________________
> Michael Vorburger, Odyssey Financial Technologies
> (...)
>
> _____
> WITH existing DB, when ALTERing:
>
> run:
>      [java] 47  hellojpa  INFO   [main] openjpa.Runtime - Starting
> OpenJPA 1.0.1
>      [java] 125  hellojpa  INFO   [main] openjpa.jdbc.JDBC - Using
> dictionary class "org.apache.openjpa.jdbc.sql.DerbyDictionary".
>      [java] 2156  hellojpa  TRACE  [main] openjpa.jdbc.SQL - <t
> 19206130, conn 3803825> executing stmnt 9564165 ALTER TABLE Message ADD
> group VARCHAR(255)
>      [java] 2188  hellojpa  TRACE  [main] openjpa.jdbc.SQL - <t
> 19206130, conn 3803825> [32 ms] spent
>      [java] Exception in thread "main" <openjpa-1.0.1-r420667:592145
> nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: Syntax error:
> Encountered "group". {stmnt 9564165 ALTER TABLE Message ADD group
> VARCHAR(255)} [code=30000, state=42X01]
>      [java]     at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:549)
>      [java]     at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:449)
>      [java]     at
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDB
> CBrokerFactory.java:170)
>      [java]     at
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBroke
> rFactory.java:130)
>      [java]     at
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBroker
> Factory.java:186)
>      [java]     at
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBr
> okerFactory.java:142)
>      [java]     at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
> ger(EntityManagerFactoryImpl.java:192)
>      [java]     at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
> ger(EntityManagerFactoryImpl.java:145)
>      [java]     at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
> ger(EntityManagerFactoryImpl.java:56)
>      [java]     at hellojpa.Main.main(Main.java:43)
>      [java] Caused by:
> org.apache.openjpa.lib.jdbc.ReportingSQLException: Syntax error:
> Encountered "group" at line 1, column 25. {stmnt 9564165 ALTER TABLE
> Message ADD group VARC, state=42X01]
>      [java]     at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConne
> ctionDecorator.java:192)
>      [java]     at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800(Loggin
> gConnectionDecorator.java:57)
>      [java]     at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection
> $LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:754)
>      [java]     at
> org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(Delegating
> Statement.java:114)
>      [java]     at
> org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:118
> 5)
>      [java]     at
> org.apache.openjpa.jdbc.schema.SchemaTool.addColumn(SchemaTool.java:1020
> )
>      [java]     at
> org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:481)
>      [java]     at
> org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
>      [java]     at
> org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
>      [java]     at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:497)
>      [java]     ... 9 more
>
> BUILD FAILED
> C:\bin\jpa_apache-openjpa-1.0.1-binary\examples\build.xml:84: Java
> returned: 1
>
> Total time: 5 seconds
> C:\bin\jpa_apache-openjpa-1.0.1-binary\examples\hellojpa>
>
> ___________________
> With fresh DB, when CREATEing:
>
> run:
>      [java] 47  hellojpa  INFO   [main] openjpa.Runtime - Starting
> OpenJPA 1.0.1
>      [java] 125  hellojpa  INFO   [main] openjpa.jdbc.JDBC - Using
> dictionary class "org.apache.openjpa.jdbc.sql.DerbyDictionary".
>      [java] 7206  hellojpa  TRACE  [main] openjpa.jdbc.SQL - <t
> 21943671, conn 10526273> executing stmnt 33116517 CREATE TABLE Message
> (id BIGINT NOT NULL, created TIMESTAMP, grou
> ge VARCHAR(255), PRIMARY KEY (id))
>      [java] 7237  hellojpa  TRACE  [main] openjpa.jdbc.SQL - <t
> 21943671, conn 10526273> [31 ms] spent
>      [java] Exception in thread "main" <openjpa-1.0.1-r420667:592145
> nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: Syntax error:
> Encountered "group"
> . {stmnt 33116517 CREATE TABLE Message (id BIGINT NOT NULL, created
> TIMESTAMP, group VARCHAR(255), message VARCHAR(255), PRIMARY KEY (id))}
> [code=30000, state=42X01]
>      [java]     at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:549)
>      [java]     at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:449)
>      [java]     at
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDB
> CBrokerFactory.java:170)
>      [java]     at
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBroke
> rFactory.java:130)
>      [java]     at
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBroker
> Factory.java:186)
>      [java]     at
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBr
> okerFactory.java:142)
>      [java]     at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
> ger(EntityManagerFactoryImpl.java:192)
>      [java]     at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
> ger(EntityManagerFactoryImpl.java:145)
>      [java]     at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
> ger(EntityManagerFactoryImpl.java:56)
>      [java]     at hellojpa.Main.main(Main.java:43)
>      [java] Caused by:
> org.apache.openjpa.lib.jdbc.ReportingSQLException: Syntax error:
> Encountered "group" at line 1, column 62. {stmnt 33116517 CREATE TABLE
> Message (id BIGINT N
> STAMP, group VARCHAR(255), message VARCHAR(255), PRIMARY KEY (id))}
> [code=30000, state=42X01]
>      [java]     at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConne
> ctionDecorator.java:192)
>      [java]     at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800(Loggin
> gConnectionDecorator.java:57)
>      [java]     at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection
> $LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:754)
>      [java]     at
> org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(Delegating
> Statement.java:114)
>      [java]     at
> org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:118
> 5)
>      [java]     at
> org.apache.openjpa.jdbc.schema.SchemaTool.createTable(SchemaTool.java:94
> 9)
>      [java]     at
> org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:526)
>      [java]     at
> org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
>      [java]     at
> org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
>      [java]     at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:497)
>      [java]     ... 9 more
>
> BUILD FAILED
> C:\bin\jpa_apache-openjpa-1.0.1-binary\examples\build.xml:84: Java
> returned: 1
>
> Total time: 9 seconds
> C:\bin\jpa_apache-openjpa-1.0.1-binary\examples\hellojpa>
>
>
>
>
>
>
> ____________________________________________________________
>
> . This email and any files transmitted with it are CONFIDENTIAL and intended
>   solely for the use of the individual or entity to which they are addressed.
> . Any unauthorized copying, disclosure, or distribution of the material within
>   this email is strictly forbidden.
> . Any views or opinions presented within this e-mail are solely those of the
>   author and do not necessarily represent those of Odyssey Financial
> Technologies SA unless otherwise specifically stated.
> . An electronic message is not binding on its sender. Any message referring to
>   a binding engagement must be confirmed in writing and duly signed.
> . If you have received this email in error, please notify the sender 
> immediately
>   and delete the original.



-- 
Patrick Linskey
202 669 5907



____________________________________________________________

• This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
• Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
• Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
• An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
• If you have received this email in error, please notify the sender immediately
  and delete the original.

Reply via email to