Browse Source
Tests that used the `@Column` annotation to map multiple properties to a single database column failed. Mapping multiple values to one column is possible to allow for entities inside an aggregate to have the id of the aggregate as ID or as part of the ID. The reason for the test failures was that columns get referred to by different ways: Once per DerivedSqlIdentifier (i.e. with normalized spelling). And Once per `@Column` annotation. SqlIdentifier from an `@Column` annotation have always the same spelling, while the normalized version depends on the `Dialect`. In order to make the tests work for all databases all references to the column in question had to get a `@Column` annotation. This in turn required the create scripts to also use quoting when the normal case of the database did not match the case chosen in the annotation. Finally there were some tests that used hand coded SQL which now uses `SqlIdentifier` and an injected `Dialect` to arrive at the correct SQL syntax. Removed a couple of `@Ignore` annotations that got left in the code. Original pull request: #182.pull/187/head
16 changed files with 146 additions and 70 deletions
@ -1,2 +1,11 @@
@@ -1,2 +1,11 @@
|
||||
CREATE TABLE dummy_entity (id BIGINT AUTO_INCREMENT PRIMARY KEY, TEST VARCHAR(100)); |
||||
CREATE TABLE dummy_entity2 (id BIGINT AUTO_INCREMENT PRIMARY KEY, TEST VARCHAR(100), PREFIX_ATTR BIGINT); |
||||
CREATE TABLE dummy_entity |
||||
( |
||||
ID BIGINT AUTO_INCREMENT PRIMARY KEY, |
||||
TEST VARCHAR(100) |
||||
); |
||||
CREATE TABLE dummy_entity2 |
||||
( |
||||
ID BIGINT PRIMARY KEY, |
||||
TEST VARCHAR(100), |
||||
PREFIX_ATTR BIGINT |
||||
); |
||||
|
||||
@ -1,4 +1,13 @@
@@ -1,4 +1,13 @@
|
||||
DROP TABLE dummy_entity; |
||||
CREATE TABLE dummy_entity (id SERIAL PRIMARY KEY, TEST VARCHAR(100)); |
||||
CREATE TABLE dummy_entity |
||||
( |
||||
"ID" SERIAL PRIMARY KEY, |
||||
TEST VARCHAR(100) |
||||
); |
||||
DROP TABLE dummy_entity2; |
||||
CREATE TABLE dummy_entity2 (id SERIAL PRIMARY KEY, TEST VARCHAR(100), PREFIX_ATTR BIGINT); |
||||
CREATE TABLE dummy_entity2 |
||||
( |
||||
"ID" INTEGER PRIMARY KEY, |
||||
TEST VARCHAR(100), |
||||
PREFIX_ATTR BIGINT |
||||
); |
||||
|
||||
@ -1,4 +1,15 @@
@@ -1,4 +1,15 @@
|
||||
DROP TABLE dummy_entity; |
||||
CREATE TABLE dummy_entity (id SERIAL PRIMARY KEY, TEST VARCHAR(100), PREFIX_TEST VARCHAR(100)); |
||||
CREATE TABLE dummy_entity |
||||
( |
||||
"ID" SERIAL PRIMARY KEY, |
||||
TEST VARCHAR(100), |
||||
PREFIX_TEST VARCHAR(100) |
||||
); |
||||
DROP TABLE dummy_entity2; |
||||
CREATE TABLE dummy_entity2 (id BIGINT, ORDER_KEY BIGINT, TEST VARCHAR(100), PRIMARY KEY (id, ORDER_KEY)); |
||||
CREATE TABLE dummy_entity2 |
||||
( |
||||
"ID" BIGINT, |
||||
"ORDER_KEY" BIGINT, |
||||
TEST VARCHAR(100), |
||||
PRIMARY KEY ("ID", "ORDER_KEY") |
||||
); |
||||
|
||||
@ -1,4 +1,22 @@
@@ -1,4 +1,22 @@
|
||||
DROP TABLE dummy_entity; |
||||
CREATE TABLE dummy_entity (id SERIAL PRIMARY KEY, TEST VARCHAR(100), PREFIX_TEST VARCHAR(100)); |
||||
CREATE TABLE dummy_entity |
||||
( |
||||
"ID" SERIAL PRIMARY KEY, |
||||
TEST VARCHAR(100), |
||||
PREFIX_TEST VARCHAR(100) |
||||
); |
||||
DROP TABLE dummy_entity2; |
||||
CREATE TABLE dummy_entity2 (id SERIAL PRIMARY KEY, TEST VARCHAR(100)); |
||||
CREATE TABLE dummy_entity2 |
||||
( |
||||
"ID" SERIAL PRIMARY KEY, |
||||
TEST VARCHAR(100) |
||||
); |
||||
-- |
||||
-- SELECT "dummy_entity"."ID" AS "ID", |
||||
-- "dummy_entity"."test" AS "test", |
||||
-- "dummy_entity"."prefix_test" AS "prefix_test", |
||||
-- "PREFIX_dummyEntity2"."id" AS "prefix_dummyentity2_id", |
||||
-- "PREFIX_dummyEntity2"."test" AS "prefix_dummyentity2_test" |
||||
-- FROM "dummy_entity" |
||||
-- LEFT OUTER JOIN "dummy_entity2" AS "PREFIX_dummyEntity2" ON |
||||
-- "PREFIX_dummyEntity2"."ID" = "dummy_entity"."ID" |
||||
Loading…
Reference in new issue