From c5c60dadde9f5ea6651153a95c4fd141c731b51b Mon Sep 17 00:00:00 2001 From: Jens Schauder Date: Mon, 30 Jan 2023 13:55:34 +0100 Subject: [PATCH] Polishing. Original pull request #1403 See #1286 --- .../data/jdbc/core/convert/SqlGenerator.java | 45 ++++++++----------- ...dbcRepositoryEmbeddedIntegrationTests.java | 4 +- ...RepositoryEmbeddedIntegrationTests-db2.sql | 29 +++++++++--- ...cRepositoryEmbeddedIntegrationTests-h2.sql | 26 +++++++++-- ...epositoryEmbeddedIntegrationTests-hsql.sql | 26 +++++++++-- ...sitoryEmbeddedIntegrationTests-mariadb.sql | 26 +++++++++-- ...positoryEmbeddedIntegrationTests-mssql.sql | 29 +++++++++--- ...positoryEmbeddedIntegrationTests-mysql.sql | 26 +++++++++-- ...ositoryEmbeddedIntegrationTests-oracle.sql | 4 +- ...itoryEmbeddedIntegrationTests-postgres.sql | 29 +++++++++--- 10 files changed, 185 insertions(+), 59 deletions(-) diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlGenerator.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlGenerator.java index fab5fc9e..ecc2acc4 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlGenerator.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlGenerator.java @@ -23,7 +23,6 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.data.jdbc.repository.support.SimpleJdbcRepository; import org.springframework.data.mapping.PersistentPropertyPath; -import org.springframework.data.mapping.PropertyPath; import org.springframework.data.mapping.context.MappingContext; import org.springframework.data.relational.core.dialect.Dialect; import org.springframework.data.relational.core.dialect.RenderContextFactory; @@ -697,13 +696,13 @@ class SqlGenerator { private DeleteBuilder.DeleteWhereAndOr createBaseDeleteById(Table table) { - return Delete.builder().from(table) + return Delete.builder().from(table) // .where(getIdColumn().isEqualTo(getBindMarker(ID_SQL_PARAMETER))); } private DeleteBuilder.DeleteWhereAndOr createBaseDeleteByIdIn(Table table) { - return Delete.builder().from(table) + return Delete.builder().from(table) // .where(getIdColumn().in(getBindMarker(IDS_SQL_PARAMETER))); } @@ -784,45 +783,37 @@ class SqlGenerator { } private OrderByField orderToOrderByField(Sort.Order order) { + SqlIdentifier columnName = getColumnNameToSortBy(order); Column column = Column.create(columnName, this.getTable()); return OrderByField.from(column, order.getDirection()).withNullHandling(order.getNullHandling()); } private SqlIdentifier getColumnNameToSortBy(Sort.Order order) { - SqlIdentifier columnName = null; + RelationalPersistentProperty propertyToSortBy = entity.getPersistentProperty(order.getProperty()); if (propertyToSortBy != null) { return propertyToSortBy.getColumnName(); } - PersistentPropertyPath persistentPropertyPath = mappingContext.getPersistentPropertyPath( - order.getProperty(), entity.getType() - ); + PersistentPropertyPath persistentPropertyPath = mappingContext + .getPersistentPropertyPath(order.getProperty(), entity.getType()); propertyToSortBy = persistentPropertyPath.getBaseProperty(); - if (propertyToSortBy == null || !propertyToSortBy.isEmbedded()) { - throwPropertyNotMarkedAsEmbeddedException(order); - } else { - RelationalPersistentEntity embeddedEntity = mappingContext.getRequiredPersistentEntity(propertyToSortBy.getType()); - columnName = embeddedEntity.getRequiredPersistentProperty(extractFieldNameFromEmbeddedProperty(order)).getColumnName(); - } - return columnName; - } + Assert.state(propertyToSortBy != null && propertyToSortBy.isEmbedded(), () -> String.format( // + "Specified sorting property '%s' is expected to " + // + "be the property, named '%s', of embedded entity '%s', but field '%s' is " + // + "not marked with @Embedded", // + order.getProperty(), // + extractFieldNameFromEmbeddedProperty(order), // + extractEmbeddedPropertyName(order), // + extractEmbeddedPropertyName(order) // + )); - private void throwPropertyNotMarkedAsEmbeddedException(Sort.Order order) { - throw new IllegalArgumentException( - String.format( - "Specified sorting property '%s' is expected to " + - "be the property, named '%s', of embedded entity '%s', but field '%s' is " + - "not marked with @Embedded", - order.getProperty(), - extractFieldNameFromEmbeddedProperty(order), - extractEmbeddedPropertyName(order), - extractEmbeddedPropertyName(order) - ) - ); + RelationalPersistentEntity embeddedEntity = mappingContext + .getRequiredPersistentEntity(propertyToSortBy.getType()); + return embeddedEntity.getRequiredPersistentProperty(extractFieldNameFromEmbeddedProperty(order)).getColumnName(); } public String extractEmbeddedPropertyName(Sort.Order order) { diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryEmbeddedIntegrationTests.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryEmbeddedIntegrationTests.java index 2ceea555..957b4c16 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryEmbeddedIntegrationTests.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryEmbeddedIntegrationTests.java @@ -92,7 +92,6 @@ public class JdbcRepositoryEmbeddedIntegrationTests { @Autowired NamedParameterJdbcTemplate template; @Autowired DummyEntityRepository repository; @Autowired PersonRepository personRepository; - @Autowired WithDotColumnRepo withDotColumnRepo; @Test // DATAJDBC-111 @@ -246,6 +245,7 @@ public class JdbcRepositoryEmbeddedIntegrationTests { @Test // GH-1286 public void findOrderedByEmbeddedProperty() { + Person first = new Person(null, "Bob", "Seattle", new PersonContacts("ddd@example.com", "+1 111 1111 11 11")); Person second = new Person(null, "Alex", "LA", new PersonContacts("aaa@example.com", "+2 222 2222 22 22")); Person third = new Person(null, "Sarah", "NY", new PersonContacts("ggg@example.com", "+3 333 3333 33 33")); @@ -254,7 +254,6 @@ public class JdbcRepositoryEmbeddedIntegrationTests { Iterable fetchedPersons = personRepository.findAll(Sort.by(new Sort.Order(Sort.Direction.ASC, "personContacts.email"))); - Assertions.assertThat(fetchedPersons).hasSize(3); Assertions.assertThat(fetchedPersons).containsExactly(second, first, third); } @@ -269,7 +268,6 @@ public class JdbcRepositoryEmbeddedIntegrationTests { Iterable fetchedPersons = withDotColumnRepo.findAll(Sort.by(new Sort.Order(Sort.Direction.ASC, "address"))); - Assertions.assertThat(fetchedPersons).hasSize(3); Assertions.assertThat(fetchedPersons).containsExactly(second, first, third); } diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-db2.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-db2.sql index f61158e9..4bff06c8 100644 --- a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-db2.sql +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-db2.sql @@ -1,8 +1,27 @@ DROP TABLE dummy_entity; -CREATE TABLE dummy_entity ( id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, TEST VARCHAR(100), PREFIX2_ATTR BIGINT, PREFIX_TEST VARCHAR(100), PREFIX_PREFIX2_ATTR BIGINT); - DROP TABLE SORT_EMBEDDED_ENTITY; -CREATE TABLE SORT_EMBEDDED_ENTITY (id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, first_name VARCHAR(100), address VARCHAR(255), email VARCHAR(255), phone_number VARCHAR(255)); - DROP TABLE WITH_DOT_COLUMN; -CREATE TABLE WITH_DOT_COLUMN (id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, "address.city" VARCHAR(255)); \ No newline at end of file + +CREATE TABLE dummy_entity +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, + TEST VARCHAR(100), + PREFIX2_ATTR BIGINT, + PREFIX_TEST VARCHAR(100), + PREFIX_PREFIX2_ATTR BIGINT +); + +CREATE TABLE SORT_EMBEDDED_ENTITY +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, + first_name VARCHAR(100), + address VARCHAR(255), + email VARCHAR(255), + phone_number VARCHAR(255) +); + +CREATE TABLE WITH_DOT_COLUMN +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, + "address.city" VARCHAR(255) +); \ No newline at end of file diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-h2.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-h2.sql index 91d10ca8..b9bdb6c6 100644 --- a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-h2.sql +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-h2.sql @@ -1,3 +1,23 @@ -CREATE TABLE dummy_entity ( id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, TEST VARCHAR(100), PREFIX2_ATTR BIGINT, PREFIX_TEST VARCHAR(100), PREFIX_PREFIX2_ATTR BIGINT); -CREATE TABLE SORT_EMBEDDED_ENTITY (id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, first_name VARCHAR(100), address VARCHAR(255), email VARCHAR(255), phone_number VARCHAR(255)); -CREATE TABLE WITH_DOT_COLUMN (id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, "address.city" VARCHAR(255)); \ No newline at end of file +CREATE TABLE dummy_entity +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, + TEST VARCHAR(100), + PREFIX2_ATTR BIGINT, + PREFIX_TEST VARCHAR(100), + PREFIX_PREFIX2_ATTR BIGINT +); + +CREATE TABLE SORT_EMBEDDED_ENTITY +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, + first_name VARCHAR(100), + address VARCHAR(255), + email VARCHAR(255), + phone_number VARCHAR(255) +); + +CREATE TABLE WITH_DOT_COLUMN +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, + "address.city" VARCHAR(255) +); \ No newline at end of file diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-hsql.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-hsql.sql index 91d10ca8..b9bdb6c6 100644 --- a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-hsql.sql +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-hsql.sql @@ -1,3 +1,23 @@ -CREATE TABLE dummy_entity ( id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, TEST VARCHAR(100), PREFIX2_ATTR BIGINT, PREFIX_TEST VARCHAR(100), PREFIX_PREFIX2_ATTR BIGINT); -CREATE TABLE SORT_EMBEDDED_ENTITY (id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, first_name VARCHAR(100), address VARCHAR(255), email VARCHAR(255), phone_number VARCHAR(255)); -CREATE TABLE WITH_DOT_COLUMN (id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, "address.city" VARCHAR(255)); \ No newline at end of file +CREATE TABLE dummy_entity +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, + TEST VARCHAR(100), + PREFIX2_ATTR BIGINT, + PREFIX_TEST VARCHAR(100), + PREFIX_PREFIX2_ATTR BIGINT +); + +CREATE TABLE SORT_EMBEDDED_ENTITY +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, + first_name VARCHAR(100), + address VARCHAR(255), + email VARCHAR(255), + phone_number VARCHAR(255) +); + +CREATE TABLE WITH_DOT_COLUMN +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 ) PRIMARY KEY, + "address.city" VARCHAR(255) +); \ No newline at end of file diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-mariadb.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-mariadb.sql index e203ab3b..6057c50c 100644 --- a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-mariadb.sql +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-mariadb.sql @@ -1,3 +1,23 @@ -CREATE TABLE dummy_entity (id BIGINT AUTO_INCREMENT PRIMARY KEY, TEST VARCHAR(100), PREFIX2_ATTR BIGINT, PREFIX_TEST VARCHAR(100), PREFIX_PREFIX2_ATTR BIGINT); -CREATE TABLE SORT_EMBEDDED_ENTITY (id BIGINT AUTO_INCREMENT PRIMARY KEY, first_name VARCHAR(100), address VARCHAR(255), email VARCHAR(255), phone_number VARCHAR(255)); -CREATE TABLE WITH_DOT_COLUMN (id BIGINT AUTO_INCREMENT PRIMARY KEY, `address.city` VARCHAR(255)); \ No newline at end of file +CREATE TABLE dummy_entity +( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + TEST VARCHAR(100), + PREFIX2_ATTR BIGINT, + PREFIX_TEST VARCHAR(100), + PREFIX_PREFIX2_ATTR BIGINT +); + +CREATE TABLE SORT_EMBEDDED_ENTITY +( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + first_name VARCHAR(100), + address VARCHAR(255), + email VARCHAR(255), + phone_number VARCHAR(255) +); + +CREATE TABLE WITH_DOT_COLUMN +( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + `address.city` VARCHAR(255) +); \ No newline at end of file diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-mssql.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-mssql.sql index 7b934c7b..af13a08b 100644 --- a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-mssql.sql +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-mssql.sql @@ -1,8 +1,27 @@ DROP TABLE IF EXISTS dummy_entity; -CREATE TABLE dummy_entity (id BIGINT IDENTITY PRIMARY KEY, TEST VARCHAR(100), PREFIX2_ATTR BIGINT, PREFIX_TEST VARCHAR(100), PREFIX_PREFIX2_ATTR BIGINT); - DROP TABLE IF EXISTS SORT_EMBEDDED_ENTITY; -CREATE TABLE SORT_EMBEDDED_ENTITY (id BIGINT IDENTITY PRIMARY KEY, first_name VARCHAR(100), address VARCHAR(255), email VARCHAR(255), phone_number VARCHAR(255)); - DROP TABLE IF EXISTS WITH_DOT_COLUMN; -CREATE TABLE WITH_DOT_COLUMN (id BIGINT IDENTITY PRIMARY KEY, "address.city" VARCHAR(255)); \ No newline at end of file + +CREATE TABLE dummy_entity +( + id BIGINT IDENTITY PRIMARY KEY, + TEST VARCHAR(100), + PREFIX2_ATTR BIGINT, + PREFIX_TEST VARCHAR(100), + PREFIX_PREFIX2_ATTR BIGINT +); + +CREATE TABLE SORT_EMBEDDED_ENTITY +( + id BIGINT IDENTITY PRIMARY KEY, + first_name VARCHAR(100), + address VARCHAR(255), + email VARCHAR(255), + phone_number VARCHAR(255) +); + +CREATE TABLE WITH_DOT_COLUMN +( + id BIGINT IDENTITY PRIMARY KEY, + "address.city" VARCHAR(255) +); \ No newline at end of file diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-mysql.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-mysql.sql index e203ab3b..6057c50c 100644 --- a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-mysql.sql +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-mysql.sql @@ -1,3 +1,23 @@ -CREATE TABLE dummy_entity (id BIGINT AUTO_INCREMENT PRIMARY KEY, TEST VARCHAR(100), PREFIX2_ATTR BIGINT, PREFIX_TEST VARCHAR(100), PREFIX_PREFIX2_ATTR BIGINT); -CREATE TABLE SORT_EMBEDDED_ENTITY (id BIGINT AUTO_INCREMENT PRIMARY KEY, first_name VARCHAR(100), address VARCHAR(255), email VARCHAR(255), phone_number VARCHAR(255)); -CREATE TABLE WITH_DOT_COLUMN (id BIGINT AUTO_INCREMENT PRIMARY KEY, `address.city` VARCHAR(255)); \ No newline at end of file +CREATE TABLE dummy_entity +( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + TEST VARCHAR(100), + PREFIX2_ATTR BIGINT, + PREFIX_TEST VARCHAR(100), + PREFIX_PREFIX2_ATTR BIGINT +); + +CREATE TABLE SORT_EMBEDDED_ENTITY +( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + first_name VARCHAR(100), + address VARCHAR(255), + email VARCHAR(255), + phone_number VARCHAR(255) +); + +CREATE TABLE WITH_DOT_COLUMN +( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + `address.city` VARCHAR(255) +); \ No newline at end of file diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-oracle.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-oracle.sql index 02766179..5ea28154 100644 --- a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-oracle.sql +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-oracle.sql @@ -1,4 +1,6 @@ DROP TABLE DUMMY_ENTITY CASCADE CONSTRAINTS PURGE; +DROP TABLE SORT_EMBEDDED_ENTITY CASCADE CONSTRAINTS PURGE; +DROP TABLE WITH_DOT_COLUMN CASCADE CONSTRAINTS PURGE; CREATE TABLE DUMMY_ENTITY ( ID NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY PRIMARY KEY, @@ -8,7 +10,6 @@ CREATE TABLE DUMMY_ENTITY ( PREFIX_PREFIX2_ATTR NUMBER ); -DROP TABLE SORT_EMBEDDED_ENTITY CASCADE CONSTRAINTS PURGE; CREATE TABLE SORT_EMBEDDED_ENTITY ( id NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY PRIMARY KEY, @@ -18,7 +19,6 @@ CREATE TABLE SORT_EMBEDDED_ENTITY ( phone_number VARCHAR(255) ); -DROP TABLE WITH_DOT_COLUMN CASCADE CONSTRAINTS PURGE; CREATE TABLE WITH_DOT_COLUMN ( id NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY PRIMARY KEY, diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-postgres.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-postgres.sql index c56a4b28..da7226e2 100644 --- a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-postgres.sql +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedIntegrationTests-postgres.sql @@ -1,8 +1,27 @@ DROP TABLE dummy_entity; -CREATE TABLE dummy_entity (id SERIAL PRIMARY KEY, TEST VARCHAR(100), PREFIX2_ATTR BIGINT, PREFIX_TEST VARCHAR(100), PREFIX_PREFIX2_ATTR BIGINT); - DROP TABLE "SORT_EMBEDDED_ENTITY"; -CREATE TABLE "SORT_EMBEDDED_ENTITY" (id SERIAL PRIMARY KEY, first_name VARCHAR(100), address VARCHAR(255), email VARCHAR(255), phone_number VARCHAR(255)); - DROP TABLE WITH_DOT_COLUMN; -CREATE TABLE WITH_DOT_COLUMN (id SERIAL PRIMARY KEY, "address.city" VARCHAR(255)); \ No newline at end of file + +CREATE TABLE dummy_entity +( + id SERIAL PRIMARY KEY, + TEST VARCHAR(100), + PREFIX2_ATTR BIGINT, + PREFIX_TEST VARCHAR(100), + PREFIX_PREFIX2_ATTR BIGINT +); + +CREATE TABLE "SORT_EMBEDDED_ENTITY" +( + id SERIAL PRIMARY KEY, + first_name VARCHAR(100), + address VARCHAR(255), + email VARCHAR(255), + phone_number VARCHAR(255) +); + +CREATE TABLE WITH_DOT_COLUMN +( + id SERIAL PRIMARY KEY, + "address.city" VARCHAR(255) +); \ No newline at end of file