-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow setting additional Hibernate quoting options
Deprecate the property `globally-quoted-identifiers` indicating to use `quote-identifiers.strategy` property. It can be possible to skip column definitions when quoting identifiers or quote only the deemed keywords.
- Loading branch information
Showing
11 changed files
with
132 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
...loyment/src/test/java/io/quarkus/hibernate/orm/quoted_indentifiers/JPAQuotedTestCase.java
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
...ment/src/test/java/io/quarkus/hibernate/orm/quoting_strategies/AbstractJPAQuotedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.quarkus.hibernate.orm.quoting_strategies; | ||
|
||
import static org.hamcrest.core.StringContains.containsString; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.restassured.RestAssured; | ||
|
||
public abstract class AbstractJPAQuotedTest { | ||
|
||
@Test | ||
public void testQuotedIdentifiers() { | ||
RestAssured.when().post("/jpa-test-quoted").then() | ||
.body(containsString("ok")); | ||
|
||
RestAssured.when().get("/jpa-test-quoted").then() | ||
.body(containsString("group_name"), containsString("group_value")); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...t/src/test/java/io/quarkus/hibernate/orm/quoting_strategies/JPAQuotedIdentifiersTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.quarkus.hibernate.orm.quoting_strategies; | ||
|
||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusDevModeTest; | ||
|
||
/** | ||
* Failed to fetch entity with reserved name and containing one column with reserved name and column definition. | ||
* <p> | ||
* To resolve the simulated situation, this test uses the quoting strategy {@code all-except-column-definitions}. | ||
*/ | ||
public class JPAQuotedIdentifiersTest extends AbstractJPAQuotedTest { | ||
|
||
@RegisterExtension | ||
final static QuarkusDevModeTest TEST = new QuarkusDevModeTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(Group.class, QuotedResource.class) | ||
.addAsResource("application-quoted-identifiers.properties", "application.properties")); | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
...ment/src/test/java/io/quarkus/hibernate/orm/quoting_strategies/JPAQuotedKeywordsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.quarkus.hibernate.orm.quoting_strategies; | ||
|
||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusDevModeTest; | ||
|
||
/** | ||
* Failed to fetch entity with reserved name and containing one column with reserved name and column definition. | ||
* <p> | ||
* To resolve the simulated situation, this test uses the quoting strategy {@code auto-keywords}. | ||
*/ | ||
public class JPAQuotedKeywordsTest extends AbstractJPAQuotedTest { | ||
|
||
@RegisterExtension | ||
final static QuarkusDevModeTest TEST = new QuarkusDevModeTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(Group.class, QuotedResource.class) | ||
.addAsResource("application-quoted-keywords.properties", "application.properties")); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...nsions/hibernate-orm/deployment/src/test/resources/application-quoted-keywords.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
quarkus.datasource.db-kind=h2 | ||
quarkus.datasource.jdbc.url=jdbc:h2:mem:test | ||
|
||
#quarkus.hibernate-orm.log.sql=true | ||
quarkus.hibernate-orm.database.generation=drop-and-create | ||
|
||
quarkus.hibernate-orm.quote-identifiers.strategy=only-keywords |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters