Skip to content

Commit

Permalink
HHH-18588 add changes for chapter 2
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan.xu committed Sep 10, 2024
1 parent 0bd109a commit 45f4a3e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions documentation/src/main/asciidoc/introduction/Configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
== Configuration and bootstrap

We would love to make this section short.
Unfortunately, there's several distinct ways to configure and bootstrap Hibernate, and we're going to have to describe at least two of them in detail.
Unfortunately, there are several distinct ways to configure and bootstrap Hibernate, and we're going to have to describe at least two of them in detail.

The four basic ways to obtain an instance of Hibernate are shown in the following table:

.Four ways to bootstrap Hibernate
[%breakable,cols="50,50"]
|===

Expand Down Expand Up @@ -65,13 +66,13 @@ driver for your database.
| MySQL or TiDB | `com.mysql:mysql-connector-j:{version}`
| MariaDB | `org.mariadb.jdbc:mariadb-java-client:{version}`
| DB2 | `com.ibm.db2:jcc:{version}`
| SQL Server | `com.microsoft.sqlserver:mssql-jdbc:${version}`
| Oracle | `com.oracle.database.jdbc:ojdbc11:${version}`
| SQL Server | `com.microsoft.sqlserver:mssql-jdbc:{version}`
| Oracle | `com.oracle.database.jdbc:ojdbc11:{version}`
| H2 | `com.h2database:h2:{version}`
| HSQLDB | `org.hsqldb:hsqldb:{version}`
|===

Where `{version}` is the latest version of the JDBC driver for your databse.
Where `{version}` is the latest version of the JDBC driver for your database.

[[optional-dependencies]]
=== Optional dependencies
Expand Down Expand Up @@ -175,7 +176,7 @@ Each `<class>` element specifies the fully-qualified name of an entity class.

.Scanning for entity classes
****
In some container environments, for example, in any EE container, the `<class>` elements are unnecessary, since the container will scan the archive for annotated classes, and automatically recognize any class annotated `@Entity`.
In some container environments, for example, in any EE container, the `<class>` elements are unnecessary, since the container will scan the archive for annotated classes, and automatically recognize any class annotated with `@Entity`.
****

Each `<property>` element specifies a _configuration property_ and its value.
Expand Down Expand Up @@ -310,7 +311,7 @@ jakarta.persistence.database-major-version=15
jakarta.persistence.database-minor-version=7
----

The product name is the value returned by `java.sql.DatabaseMetaData.getDatabaseProductName()`, for example, `PostgreSQL`, `MySQL` `H2`, `Oracle`, `EnterpriseDB`, `MariaDB`, or `Microsoft SQL Server`.
The product name is the value returned by `java.sql.DatabaseMetaData.getDatabaseProductName()`, for example, `PostgreSQL`, `MySQL`, `H2`, `Oracle`, `EnterpriseDB`, `MariaDB`, or `Microsoft SQL Server`.

.Settings needed when database is inaccessible at startup
[%breakable,cols="50,~"]
Expand Down Expand Up @@ -382,7 +383,7 @@ Additionally, drop the schema on `SessionFactory` shutdown
| (Optional) If `true`, automatically create schemas and catalogs

| `jakarta.persistence.schema-generation.create-source`
| (Optional) If `metadata-then-script` or `script-then-metadata`, execute an additional SQL script when exported tables and sequences
| (Optional) If `metadata-then-script` or `script-then-metadata`, execute an additional SQL script after or before exporting tables , sequences and constraints; if `metadata` or `script`, only export tables, sequences and constraints or only execute a SQL script

| `jakarta.persistence.schema-generation.create-script-source`
| (Optional) The name of a SQL DDL script to be executed
Expand Down Expand Up @@ -424,7 +425,7 @@ Persistence.generateSchema("org.hibernate.example",

To see the generated SQL as it's sent to the database, you have two options.

One way is to set the property `hibernate.show_sql` to `true`, and Hibernate will log SQL direct to the console.
One way is to set the property `hibernate.show_sql` to `true`, and Hibernate will log SQL directly to the console.
You can make the output much more readable by enabling formatting or highlighting.
These settings really help when troubleshooting the generated SQL statements.

Expand Down

0 comments on commit 45f4a3e

Please sign in to comment.