Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions documentation/src/main/asciidoc/introduction/Configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,32 @@ Writing your own `PhysicalNamingStrategy` and/or `ImplicitNamingStrategy` is an
We'll have more to say about them in <<naming-strategies>>.
====

[[quoted-identifiers]]
=== Quoting SQL identifiers

By default, Hibernate never quotes SQL table and column names in generated SQL.
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.

The following settings enable automatic quoting:

.Settings for identifier quoting
[%breakable,cols="35,~"]
|===
| Configuration property name | Purpose

| `hibernate.auto_quote_keyword` | Automatically quote any identifier which is a SQL keyword
| `hibernate.globally_quoted_identifiers` | Automatically quote every identifier
|===

Note that `hibernate.globally_quoted_identifiers` is a synonym for `<delimited-identifiers/>` in <<configuration-jpa,`persistence.xml`>>.
We don't recommend the use of global identifier quoting, and in fact these settings are rarely used.

[TIP]
====
A better alternative is to explicitly quote table and column names where necessary, by writing `@Table(name="\"View\")` or `@Column(name="\"number\"")`.
Since that's kinda ugly, Hibernate lets us use a backtick as the quote character instead of the double quote.
====

[[nationalized-chars]]
=== Nationalized character data in SQL Server

Expand Down
Loading