[ 
https://issues.apache.org/jira/browse/OPENJPA-3075?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18143679#comment-18143679
 ] 

ASF subversion and git services commented on OPENJPA-3075:
----------------------------------------------------------

Commit 56c0695edab9b903ef9729f01a920f526880f783 in openjpa's branch 
refs/heads/OPENJPA-3076 from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=56c0695ed ]

[OPENJPA-3075] DerbyDictionary does not know WINDOW and other words Derby 
reserves (#303)

* [OPENJPA-3075] Use the words Derby rejects as unquoted identifiers as 
reserved words of the Derby dictionary

Derby 10.16 rejects BIGINT, CURRENT_ROLE, CURSORS, DEFINER, DETERMINISTIC,
GETCURRENTCONNECTION, INVOKER, WINDOW and XMLQUERY as unquoted table,
sequence, index, constraint and schema names, and CURSORS also as a column
name, but the dictionary did not know them, so the names generated from them
were used as they are and the DDL failed. The words were found by trying every
token of the Derby grammar and the SQL keywords known to OpenJPA as an unquoted
table and column name. Only names Derby rejects change.

* [OPENJPA-3075] Run the reserved word entity test only on Derby

The entity uses WINDOW as a column name, which MySQL 8 reserves but the MySQL
dictionary does not know, so the test of persisting, finding and querying the
entity is restricted to Derby like the test of the column names.

* [OPENJPA-3075] Say in the release notes which names now avoid the Derby 
reserved words

Only CURSORS changes as a column name. The other words change generated table,
sequence, index, constraint and schema names; the table name the JPA mapping
defaults take from the entity name is still used as it is.

* [OPENJPA-3075] Make the JPA default table names valid that Derby rejects

The JPA mapping defaults take the table name from the entity name, and the
join and collection table names from it, without consulting the dictionary,
so an entity named Window, Order or User gave a CREATE TABLE Derby rejects.

A dictionary now knows the words its database rejects as unquoted table names,
and only a default table name that is one of these words, and not delimited, is
made valid the way the dictionary makes its generated names valid, without
making it unique so that the same name is derived when the table exists. For
Derby these are the words it rejects as unquoted column names, which were
measured to be the same; other dictionaries have no such words, so their
default table names do not change, and reserved words Derby accepts as table
names, such as ACTION or COUNT, are kept as well.

* [OPENJPA-3075] Test entities named Window, Order and User with default table 
names on Derby

The Window entity loses its explicit table name, and entities named Order and
User and an entity whose default collection table name Derby rejects are added,
with a join table and collection tables, which are created, persisted, found,
queried and bulk updated. Order and User are reserved by most databases, so the
whole test only runs on Derby.

* [OPENJPA-3075] Say in the release notes that default table names Derby 
rejects are fixed

The entry gets the issue number, and says that the default table names of
entities named Window, Order or User, which Derby rejects, are what is fixed,
along with the words Derby reserves that the dictionary did not know.

* [OPENJPA-3075] Make the default sequence names valid that Derby rejects

A sequence generator that names no sequence uses its generator name as the
database sequence name, which was never checked against the dictionary, so a
generator named Window, Order or User gave a CREATE SEQUENCE Derby rejects.

The metadata now records that the sequence name is the default one, and the
mapping configures the sequence with that name made valid by the dictionary,
under the same conditions as default table names: only a name that is one of
the words the database rejects, and not delimited, is changed, without making
it unique. Derby 10.16 rejects all of its invalid table words as unquoted
sequence names as well; other dictionaries have no such words, so their
sequence names do not change, and names given in sequenceName are kept.

* [OPENJPA-3075] Say in the release notes that default sequence names Derby 
rejects are fixed

The entry now names the default sequence names of sequence generators named 
Window, Order or User next to the default table names.

* [OPENJPA-3075] Keep the label and the constructors of Window that the MySQL 
reserved word test uses

>  DerbyDictionary does not know WINDOW and other words Derby reserves
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-3075
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-3075
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Richard Zowalla
>            Assignee: Richard Zowalla
>            Priority: Major
>             Fix For: 4.2.0
>
>
> DerbyDictionary's reserved words are missing words that Derby rejects as 
> unquoted identifiers, such as WINDOW. An entity named Window therefore 
> produces CREATE TABLE Window, which fails on Derby. Add the missing words, 
> taken from Derby itself.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to