correctly describe automatic quoting in doc

This commit is contained in:
Gavin King 2024-11-29 12:18:13 +01:00
parent d433133946
commit 38fb68a57c
3 changed files with 15 additions and 2 deletions

View File

@ -503,10 +503,11 @@ We'll have more to say about them in <<naming-strategies>>.
[[quoted-identifiers]] [[quoted-identifiers]]
=== Quoting SQL identifiers === Quoting SQL identifiers
By default, Hibernate never quotes SQL table and column names in generated SQL. By default, Hibernate never quotes a SQL table or column name in generated SQL when the name contains only alphanumeric characters.
This behavior is usually much more convenient, especially when working with a legacy schema, since unquoted identifiers aren't case-sensitive, and so Hibernate doesn't need to know or care whether a column is named `NAME`, `name`, or `Name` on the database side. This behavior is usually much more convenient, especially when working with a legacy schema, since unquoted identifiers aren't case-sensitive, and so Hibernate doesn't need to know or care whether a column is named `NAME`, `name`, or `Name` on the database side.
On the other hand, any table or column name containing a punctuation character like `$` is automatically quoted by default.
The following settings enable automatic quoting: The following settings enable additional automatic quoting:
.Settings for identifier quoting .Settings for identifier quoting
[%breakable,cols="35,~"] [%breakable,cols="35,~"]

View File

@ -59,4 +59,15 @@ public class QueryTest {
} }
); );
} }
@Test
@JiraKey(value = "HHH-14125" )
public void testSelectElementCollectionProperty(SessionFactoryScope scope) {
// Selecting property directly works for basic types and associated entities, should also work for ElementCollection
scope.inSession(
session -> {
session.createQuery( "select e.someStrings from EntityWithAnElementCollection e" ).list();
}
);
}
} }

View File

@ -98,6 +98,7 @@ public class LocalDateTimeTest extends AbstractJavaTimeTypeTest<LocalDateTime, L
// This does not work, but it's unrelated to HHH-13379; see HHH-13515 // This does not work, but it's unrelated to HHH-13379; see HHH-13515
//.add( 2018, 9, 30, 2, 0, 0, 0, ZONE_AUCKLAND ) //.add( 2018, 9, 30, 2, 0, 0, 0, ZONE_AUCKLAND )
.add( 2018, 9, 30, 3, 0, 0, 0, ZONE_AUCKLAND ) .add( 2018, 9, 30, 3, 0, 0, 0, ZONE_AUCKLAND )
.add( -1, 1, 1, 0, 0, 0, 0, ZONE_PARIS )
.build(); .build();
} }