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

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

Commit bff9bfc9db913383b7491e8d4096186a22e508ca in openjpa's branch 
refs/heads/master from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=bff9bfc9d ]

[OPENJPA-3038] MySQL/MariaDB constraint names and case insensitive TCK tables 
(#270)

* [OPENJPA-3038] Name MySQL/MariaDB constraints with CONSTRAINT <name>

MySQLDictionary and MariaDBDictionary used constraintNameMode=mid and
emitted named constraints as FOREIGN KEY <name> (...), UNIQUE <name> (...)
and PRIMARY KEY <name> (...). Switch both to the default
CONSTRAINT <name> FOREIGN KEY / UNIQUE / PRIMARY KEY form.

MySQL: since 8.0.16 the name in FOREIGN KEY <name> (...) only names the
backing index; the constraint gets a generated <table>_ibfk_<n> name, so
DROP FOREIGN KEY <name> in generated drop scripts fails.

MySQL and MariaDB: schema generation scripts must contain the spec form
CONSTRAINT <name> FOREIGN KEY / UNIQUE, which the TCK checks for.

Behaviour change for MySQL users: an explicit foreign key name is now an
InnoDB constraint name, which must be unique per database rather than
per table, so reusing the same @ForeignKey(name=...) on several tables
now fails at DDL time. Named primary keys are emitted as
CONSTRAINT <name> PRIMARY KEY (MySQL ignores the name). The previous
form can be restored with DBDictionary ConstraintNameMode=mid.

* [OPENJPA-3038] Run the TCK against case insensitive MySQL table names

The TCK's MySQL scripts create upper case tables (PERSON, INSURANCE, ...)
while entities without @Table map to their entity name (Person,
Insurance). With case sensitive table names (lower_case_table_names=0,
the Linux default) SynchronizeMappings creates a second Person table, the
TCK cleanup (DELETE FROM PERSON) never removes its rows and later tests
fail with duplicate keys or foreign key violations against the empty
upper case tables.

A TCK run of master against MySQL 8.4 and MariaDB 12.3 started with
--lower_case_table_names=1 fixes 29 tests on MySQL and 30 on MariaDB
(relationship.defaults, relationship.annotations, orderby, ordercolumn,
mapkeyclass, mapkeyjoincolumn, assocoverride, derivedid ex1b, mappedsc,
bidirmanyxmany, jpa22.repeatable; on MariaDB also elementcollection)
with no regressions. No duplicate CREATE TABLE attempts appear with
the lower case names reported by the server.

Start the dockerized MySQL with lower_case_table_names=1 when run-tck32.sh
runs the TCK (pom property, default unchanged for the OpenJPA test suite)
and document the requirement for --no-docker setups. run-tck32.sh has no
MariaDB support, so only MySQL is configured here.

> MySQL: mapping, order column and map key tests fail
> ---------------------------------------------------
>
>                 Key: OPENJPA-3038
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-3038
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Richard Zowalla
>            Priority: Major
>
> These tests fail on MySQL and only report "failed", the cause has to be found 
> from the TCK logs:
> * {{Client.associationOverride}}, {{mapKeyClass}}, {{mapKeyJoinColumn}}, 
> {{mapKeyJoinColumnTest}}
> * {{Client1.orderByTest1}} to {{orderByTest4}}, {{orderColumn}}, 
> {{orderColumnTest}}
> * {{annotationMappingTest1}}, {{3}} to {{8}}, {{mappingTest1}} to {{8}}, 
> {{biDirMXMTest1}}
> * {{DIDTest}}, {{didTest}}, {{test1}}, {{joinTableTest}}, 
> {{secondaryTableTest}}, {{uniqueConstraintTest}}
> * {{Client1.setParameterParameterCalendarTemporalTypeTest}} (also on SQL 
> Server)



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

Reply via email to