Romain,

Il giorno gio 16 lug 2020 alle ore 10:13 Romain Manni-Bucau <
rmannibu...@gmail.com> ha scritto:

> Hi Enrico,
>
> 1. It should but I fear it is never used
> 2.
>
> Side note the toUpper in
>
> https://github.com/apache/openjpa/blob/0e32d4981abca26ea97d8e66c643b2bf5162d1e9/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Table.java#L335
> is
> very weird but we can likely make the map case insensitive for some DB
> (going through the dict probably).
>

Yes, this is part of the problem :-)



>
> Reserved words can be set in the dictionary thanks the variable of the same
> name (and you likely want to set system tables too), you can have a quick
> look to
>
> https://github.com/apache/openjpa/blob/08bb3a5a0e7573622aa6dc25763cb6513095093b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/IngresDictionary.java#L144


I am sorry but  I am not able to make it work, the reserved word list is
not take into account.
At least not during SQL generation.
Maybe I miss some part of the story.

Enrico


>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://rmannibucau.metawerx.net/> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> <
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> >
>
>
> Le jeu. 16 juil. 2020 à 10:08, Enrico Olivelli <eolive...@gmail.com> a
> écrit :
>
> > Hi,
> > I am working on contributing a DBDictionary for HerdDB (
> > https://github.com/diennea/herddb).
> >
> > Currently in HerdDBDirectory I have to set
> > setDelimitIdentifiers(true);
> > this is because HerdDB uses Apache Calcite and Calcite has a long list of
> > reserved words like 'User', 'Value'.
> >
> > In some real applications this configuration is good and it works very
> well
> > but I am not able to make OpenJPA integration tests pass (using
> > -Ptest-custom profile), in particular the first show stopper is in
> > TestPersistence.
> >
> > I have found this little problem about SelectImpl, the patch is trivial,
> I
> > just have to add a test case.
> > https://github.com/apache/openjpa/pull/68
> >
> > But now I have a harder problem.
> >
> > With setDelimitIdentifiers(true) TestPersistence fails on the second test
> > method (the first passes, testQuery) because SchemaTool does not
> understand
> > that the column AllFieldTypes#arrayOfStrings is already present on the
> > table.
> >
> > This is because in SchemaTool at this line:
> >
> >
> https://github.com/apache/openjpa/blob/master/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java#L608
> >
> > the variable colName holds this value: `arrayOfStrings` (delimited, as
> the
> > DBDictionary as delimitAll=true) but dbTable variable (that represents DB
> > metadata) contains all column names delimited but lowercased (as HerdDB
> > returns all metadata in lower case) and dbTable.getColumn returns null,
> > because when we compare delimited DBIdentifiers the comparison is not
> case
> > sensitive.
> >
> > I have played a lot with DBDictionary#schemaCase
> > and DBDictionary#delimitedCase, forcing SCHEMA_CASE_LOWER, but each
> > combination leads to errors.
> >
> > I have tried to tweak the generation of DBIdentifiers in the
> > various AbstractFieldStrategy implementations but anything I touch I
> break
> > some existing test case.
> >
> > I have also tried to work with 'reservedWords' but it looks like that the
> > reservedWordsSet is not taken into account when writing DDL and DML (I
> > didn't test SELECTs) code (looking at RowImpl#getInsertSQL for instance)
> >
> > So here a couple of questions for you experts:
> > 1) Is it good to set setDelimitIdentifiers(true) ? I don't find any
> > DBDictionary that sets this feature on
> > 2) If I can't delimit every identifier, is there a way to tell a list of
> > reserved words to be always delimited ? shall I simply
> > tweak DBDictionary#toDBName ?
> >
> >
> > Thanks in advance
> > Enrico
> >
>

Reply via email to