Hibernate Reactiveの使用
プレビューHibernate Reactive は、Hibernate ORM のリアクティブ API であり、ノンブロッキングのデータベースドライバと、データベースとのインタラクションのリアクティブなスタイルをサポートしています。
|
Hibernate Reactive は Hibernate ORM の置き換えでも、Hibernate ORM の将来でもありません。これは、高い並行性が必要なリアクティブなユースケース向けに調整された異なるスタックです。 また、デフォルトの REST レイヤーである Quarkus REST (旧称 RESTEasy Reactive) を使用する場合、Hibernate Reactive の使用は必須ではありません。Quarkus REST を Hibernate ORM と併用することは全く問題ありません。高い並行性が必要ない場合やリアクティブなパラダイムに慣れていない場合は、Hibernate ORM を使用することをお勧めします。 |
|
Hibernate Reactive は、Hibernate ORM ガイド で説明されている同じアノテーションと、ほとんどの設定で動作します。このガイドでは、Hibernate Reactive に特有の機能のみに焦点を当てます。 |
|
この技術は、previewと考えられています。 preview では、下位互換性やエコシステムでの存在は保証されていません。具体的な改善には設定や API の変更が必要になるかもしれませんが、 stable になるための計画は現在進行中です。フィードバックは メーリングリスト や GitHub の課題管理 で受け付けています。 とりうるステータスの完全なリストについては、 FAQの項目 を参照してください。 |
ソリューション
次のセクションの指示に従って、アプリケーションを段階的に作成することをお勧めします。ただし、完成した例に直接進むこともできます。
Git リポジトリーをクローンします: git clone https://github.com/quarkusio/quarkus-quickstarts.git 、または アーカイブ をダウンロードしてください。
ソリューションは hibernate-reactive-quickstart ディレクトリー にあります。
Hibernate Reactive のセットアップと設定
Quarkus で Hibernate Reactive を使用する場合、次のことを行う必要があります。
-
application.propertiesに設定を追加します -
エンティティーに
@Entityおよびその他のマッピングアノテーションを通常通り付与します
その他の設定の必要性は自動化されています。Quarkus は、いくつかの定見に基づいた選択と経験に基づいた推測を行います。
以下の依存関係をプロジェクトに追加してください:
-
Hibernate Reactive エクステンション:
io.quarkus:quarkus-hibernate-reactive -
選択したデータベース用の Reactive SQL クライアントエクステンション;以下のオプションが利用可能です:
-
quarkus-reactive-pg-client: PostgreSQL または CockroachDB 用のクライアント -
quarkus-reactive-mysql-client: MySQL または MariaDB 用のクライアント -
quarkus-reactive-mssql-client: Microsoft SQL Server 用のクライアント -
quarkus-reactive-db2-client: IBM Db2 用のクライアント -
quarkus-reactive-oracle-client: Oracle 用のクライアント
-
例えば:
<!-- Hibernate Reactive dependency -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive</artifactId>
</dependency>
<!-- Reactive SQL client for PostgreSQL -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-reactive-pg-client</artifactId>
</dependency>
// Hibernate Reactive dependency
implementation("io.quarkus:quarkus-hibernate-reactive")
Reactive SQL client for PostgreSQL
implementation("io.quarkus:quarkus-reactive-pg-client")
永続オブジェクトに @Entity を付与します。その後、application.properties に関連する設定プロパティーを追加します:
application.properties# datasource configuration
quarkus.datasource.db-kind = postgresql
quarkus.datasource.username = quarkus_test
quarkus.datasource.password = quarkus_test
quarkus.datasource.reactive.url = vertx-reactive:postgresql://localhost/quarkus_test (1)
# drop and create the database at startup (use `update` to only update the schema)
quarkus.hibernate-orm.schema-management.strategy=drop-and-create
| 1 | Hibernate ORM の設定と唯一異なるプロパティー |
これらの設定プロパティーは、一般的な Hibernate Reactive 設定ファイルにあるものと同じではないことに注意してください。これらはしばしば Hibernate Reactive の設定プロパティーにマッピングされますが、名前が異なる場合があり、必ずしも 1 対 1 でマッピングされるわけではありません。
ブロッキング (非リアクティブ) 設定とリアクティブ設定は 同じプロジェクト内で混在させることができます。
標準の persistence.xml 設定ファイルを使用して Hibernate Reactive を設定することはサポートされていません。
|
application.properties で設定できるプロパティーのリストについては、Hibernate Reactive の設定リファレンス のセクションを参照してください。
プロジェクトの依存関係に Hibernate Reactive エクステンションがリストされていれば、Quarkus の datasource 設定に基づいて Mutiny.SessionFactory が作成されます。
Dialect は Reactive SQL クライアントに基づいて選択されます (明示的に設定しない限り)。
| Dialect の選択とデータベースのバージョンに関する詳細は、Hibernate ORM ガイドの該当セクション を参照してください。 |
その後、Mutiny.SessionFactory を注入することができます:
@ApplicationScoped
public class SantaClausService {
@Inject
Mutiny.SessionFactory sf; (1)
public Uni<Void> createGift(String giftDescription) {
Gift gift = new Gift();
gift.setName(giftDescription);
return sf.withTransaction(session -> session.persist(gift)) (2)
}
}
| 1 | セッションファクトリーの注入と活用 |
| 2 | .withTransaction() はコミット時に自動的にフラッシュされます |
データベースを変更するメソッド (例: session.persist(entity) ) は、必ずトランザクション内にラップしてください。
|
@Entity
public class Gift {
private Long id;
private String name;
@Id
@SequenceGenerator(name = "giftSeq", sequenceName = "gift_id_seq", allocationSize = 1, initialValue = 1)
@GeneratedValue(generator = "giftSeq")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Hibernate Reactive の起動時に SQL ステートメントをロードするには、src/main/resources/ ディレクトリーに import.sql ファイルを追加します。このスクリプトには、任意の SQL DML ステートメントを含めることができます。各ステートメントは必ずセミコロンで終了させてください。
テストやデモ用にデータセットを用意しておくと便利です。
Using @Transactional with Hibernate Reactive
You can use the standard jakarta.transaction.Transactional annotation with Hibernate Reactive.
This provides a more familiar programming model for developers coming from Hibernate ORM.
While defining transaction handling using the annotation, you should inject Mutiny.Session or Mutiny.StatelessSession using CDI and use them in methods annotated with @Transactional.
Here’s an example showing how to use @Transactional in a REST resource:
@Path("/fruits")
public class FruitResource {
@Inject
Mutiny.Session session; (1)
@GET
@Path("/{id}")
public Uni<Fruit> getFruit(Long id) {
return session.find(Fruit.class, id);
}
@POST
@Transactional (2)
public Uni<Fruit> createFruit(Fruit fruit) {
return session.persist(fruit)
.chain(() -> session.find(Fruit.class, fruit.getId()));
}
@PUT
@Path("/{id}")
@Transactional (3)
public Uni<Fruit> updateFruit(Long id, @QueryParam("name") String newName) {
return session.find(Fruit.class, id)
.map(fruit -> {
fruit.setName(newName);
return fruit;
});
}
}
| 1 | Inject the reactive session directly |
| 2 | Use @Transactional for persist operations - creates new entities in the database |
| 3 | Use @Transactional for update operations - modifies existing entities |
The @Transactional interceptor will:
-
Lazily open a Hibernate Reactive session when first accessed
-
Begin a transaction automatically
-
Commit the transaction when the
Unicompletes successfully -
Roll back the transaction if an exception is thrown or the
Uniis cancelled -
Close the session and release the database connection when the reactive chain completes
|
There are some limitations when using See 制限事項とその他知っておくべきこと for more information. |
Hibernate Reactive の設定プロパティー
セッションファクトリーを改良したり、Quarkus の推測を導くのに役立つ、様々なオプションのプロパティーがあります。
プロパティーが設定されていない場合、Quarkus は通常、Hibernate Reactive のセットアップに必要なすべてを推測し、デフォルトのデータソースを使用するようにします。
ここに記載されている設定プロパティーでは、このようなデフォルト値を上書きしたり、様々な側面をカスタマイズおよび調整したりすることができます。
Hibernate Reactive は、Hibernate ORM で使用するのと同じプロパティーを使用します:Hibernate Reactive の設定リファレンス を参照してください。
Hibernate ORM と Reactive エクステンションの同時利用
Quarkus アプリケーションに Hibernate ORM と Hibernate Reactive の両方のエクステンションを追加すると、同じプロジェクト内で混在させることができます。
これは、アプリケーションが通常は Hibernate ORM (ブロッキング) を使用しているが、Hibernate Reactive がユースケースにより適しているか試したい場合に役立ちます。
2つ目のエクステンションを追加することで、個別のアプリケーションを作成することなく、コードの別の部分で Reactive API を使用できます。
| Hibernate ORM と Hibernate Reactive は同じ永続化コンテキストを共有しないため、特定のメソッドではどちらか一方に固執することが推奨されます。たとえば、ブロッキングな REST エンドポイントでは Hibernate ORM を使用し、Reactive な REST エンドポイントでは Hibernate Reactive を使用します。 |
-
両方のエクステンションを同時に使用するには、
pom.xmlファイルに両方のエクステンションを追加します。<!-- Hibernate reactive --> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-hibernate-reactive</artifactId> </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-reactive-pg-client</artifactId> </dependency> <!-- Hibernate ORM --> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-jdbc-postgresql</artifactId> </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-hibernate-orm</artifactId> </dependency> -
applications.propertiesファイルも更新します。
%prod.quarkus.datasource.reactive.url=postgresql:///your_database %prod.quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/hibernate_orm_test
-
JDBC ドライバーが存在すると Hibernate ORM が有効になります。それを無効にし、Hibernate Reactive のみを使用したい場合は、次のようにします。
quarkus.hibernate-orm.blocking=false
Quarkus は多くの Hibernate Reactive の設定を自動的に行い、多くの場合、より現代的なデフォルトを使用します。
CDI 統合
Quarkus で Hibernate Reactive の使用に慣れている場合は、おそらく既に CDI を使用して Mutiny.SessionFactory を注入していることでしょう。
@Inject
Mutiny.SessionFactory sessionFactory;
これにより、デフォルトの永続化ユニットの Mutiny.SessionFactory が注入されます。
Quarkus 3.0 以前は、Mutiny.Session 用の @RequestScoped Bean を注入することも可能でした。しかし、Reactive セッションのライフサイクルは CDI リクエストコンテキストのライフサイクルに適合しません。そのため、この Bean は Quarkus 3.0 で削除されました。
|
永続化ユニットのアクティブ化/非アクティブ化
永続化ユニットがビルド時に設定され、エンティティータイプまたは アクティブなデータソース が割り当てられている場合、永続化ユニットはデフォルトでアクティブになります。Quarkus は、アプリケーションの起動時に対応する Hibernate Reactive SessionFactory を開始します。
実行時に永続化ユニットを非アクティブ化するには、Hibernate ORM ガイドの該当セクション を参照してください。
|
Hibernate ORM ガイドの例に従って、アクティブな永続化ユニットのカスタム CDI Bean を宣言し、Hibernate Reactive を使用する場合は、 詳細については、CDI 統合 を参照してください。 |
スキーマ管理のための Flyway への自動移行
Hibernate Reactive は Flyway と同じアプリケーションで使用できます。Reactive アプリケーションでの Flyway の設定に関する詳細については、 Flyway エクステンションドキュメントのこのセクション を参照してください。
|
開発モードで実行中に Flyway エクステンション がインストールされている場合、Quarkus は Hibernate Reactive によって自動的に生成されたスキーマを使用して、Flyway の設定を初期化する簡単な方法を提供します。 詳細は Hibernate ORM ガイド を参照してください。 |
テスト
@QuarkusTest で Hibernate Reactive を使用することは、API の非同期性とすべての操作を Vert.x イベントループで実行する必要があるという事実により、Hibernate ORM を使用するより少し複雑です。
これらのテストを書くには、2つのコンポーネントが必要です。
-
テストメソッドでの
@io.quarkus.test.vertx.RunOnVertxContextまたは@io.quarkus.test.TestReactiveTransactionの使用 -
テストメソッドのパラメーターとしての
io.quarkus.test.vertx.UniAsserterの使用。
これらのクラスは、quarkus-test-vertx 依存関係によって提供されます。
|
非常にシンプルな使用例は次のようになります。
@QuarkusTest
public class SomeTest {
@Inject
Mutiny.SessionFactory sessionFactory;
@Test
@RunOnVertxContext
public void testQuery(UniAsserter asserter) {
asserter.assertThat(() -> sessionFactory.withSession(s -> s.createQuery(
"from Gift g where g.name = :name").setParameter("name", "Lego").getResultList()),
list -> org.junit.jupiter.api.Assertions.assertEquals(list.size(), 1));
}
}
アサーション作成に使用できる様々なメソッドの完全な説明については、UniAsserter の Javadoc を参照してください。
|
|
また、
|
複数の永続化ユニット
複数の永続化ユニットの設定
Hibernate ORM と同様に、Hibernate Reactive は複数の永続化ユニットをサポートしています。
複数の永続化ユニットとデータソースを定義でき、それらはブロッキングと Reactive のデータソースを混在させることができます。データソースが Reactive をサポートしていることを確認するには、reactive プロパティーを true に設定する必要があります。
application.propertiesquarkus.datasource."users".reactive.url=vertx-reactive:postgresql://localhost/users (1)
quarkus.datasource."users".db-kind=postgresql
%prod.quarkus.datasource."users".username=hibernate_orm_test
%prod.quarkus.datasource."users".password=hibernate_orm_test
quarkus.datasource."inventory".reactive.url=vertx-reactive:postgresql://localhost/inventory (2)
quarkus.datasource."inventory".db-kind=postgresql
%prod.quarkus.datasource."inventory".username=hibernate_orm_test
%prod.quarkus.datasource."inventory".password=hibernate_orm_test
quarkus.hibernate-orm."users".datasource=users (3)
quarkus.hibernate-orm."users".packages=io.quarkus.hibernate.reactive.multiplepersistenceunits.model.config.user
quarkus.hibernate-orm."inventory".datasource=inventory (4)
quarkus.hibernate-orm."inventory".packages=io.quarkus.hibernate.orm.multiplepersistenceunits.model.config.inventory
| 1 | users という名前の Reactive データソースを定義します。 |
| 2 | inventory という名前の Reactive データソースを定義します。 |
| 3 | users という名前の永続化ユニットを定義し、データソースを指定します。 |
| 4 | inventory という名前の永続化ユニットを定義し、データソースを指定します。 |
名前付き永続化ユニットを使用する場合、datasource プロパティーを対応するデータソースの名前に設定する必要があります。
制限事項とその他知っておくべきこと
Quarkus は使用するライブラリーを変更しません。このルールは Hibernate Reactive にも適用されます。このエクステンションを使用する場合、ほとんどの場合、元のライブラリーを使用するのと同様の体験が得られます。
しかし、両者は同じコードを共有していますが、Quarkus は一部のコンポーネントを自動的に設定し、いくつかのエクステンションポイントにカスタム実装を注入します。これは透過的で有用なはずですが、Hibernate Reactive のエキスパートであれば、何が行われているかを知りたいかもしれません。
General limitations
-
Hibernate Reactive は
persistence.xmlファイルで設定できません。 -
このエクステンションは、現時点ではデフォルトの永続化ユニットのみを考慮します。複数の永続化ユニットや、単一の名前付き永続化ユニットを設定することはできません。
-
このエクステンションは、現時点では データベースベースのマルチテナンシー または スキーマベースのマルチテナンシー をサポートしていません。一方、Discriminator ベースのマルチテナンシー は正しく機能すると予想されます。詳細については、 https://github.com/quarkusio/quarkus/issues/15959 を参照してください。
-
Envers エクステンションとの統合はサポートされていません。
Transaction management: choosing between @Transactional and Panache annotations
With the introduction of the quarkus-reactive-transactions extension, you now have two options for managing transactions in Hibernate Reactive applications:
-
Use
jakarta.transaction.Transactionalfor declarative transaction management -
Use Panache’s transaction annotations (
@WithTransaction,@WithSession,@WithSessionOnDemand, or the programmaticPanache.withTransaction())
You must choose one approach and use it consistently throughout your application.
Mixing both transaction management styles in the same reactive pipeline is not supported and will result in an UnsupportedOperationException.
In the future, we’ll deprecate the previous annotations provided by Panache and and support only @Transactional.
You can inject either Mutiny.Session or Mutiny.StatelessSession.
Mixing both session types in the same transaction should work, but should be reserved for exotic use cases implemented by advanced users, as the (stateful) session will not be aware of changes operated through the stateless session, which could thus conflict or be silently erased by (stateful) session writes.
Using Declarative Transaction Management in different reactive pipelines
When using declarative transaction management with Vert.x context-based interceptors (@Transactional, @WithTransaction, @WithSession, @WithSessionOnDemand) in multiple methods and combining such methods with either Uni.combine().all().unis() or Uni.join().all() the same transaction might be shared by different reactive pipelines causing unpredictable behavior.
For this reason, avoid using declarative transactional management with those methods.
Other Declarative Transactional Management limitations
Reactive transactions does not use TransactionManager, thus they are local only and do not support XA transactions. Every parameter defined on the TransactionManager (such as quarkus.transaction-manager.default-transaction-timeout) will be ignored. Only a single datasource can participate in a transaction.
Reactive transactions also work exclusively within the reactive pipeline. If blocking code is executed (for example on a worker thread) as part of that pipeline, it will not be able to participate in the transaction.
Declarative reactive transactions with @Transactional can only be applied to methods returning Uni, not Multi, CompletionStage, or CompletableFuture.
Currently, only Transactional.TxType.REQUIRED is supported with reactive transactions. Other transaction types (REQUIRES_NEW, MANDATORY, etc.) will throw an UnsupportedOperationException.
Panache を使用した Hibernate Reactive の簡素化
Hibernate Reactive with Panacheエクステンションは、Active Recordスタイルのエンティティ(およびリポジトリ)を提供することでHibernate Reactiveの使用を促進し、Quarkus でエンティティを簡単に楽しく書けるようにすることに重点を置いています。
バリデーションモードと Hibernate Validator の統合
quarkus.hibernate-orm.validation.mode 設定プロパティー が Hibernate Reactive アプリケーションにどのように影響を与えるかについてさらに詳しく知るには、対応する Hibernate ORM ガイド を参照してください。これらのモードはどちらの場合でも同じように機能するためです。
Hibernate Reactive の設定リファレンス
|
一部のプロパティーの名前に「jdbc」が含まれていることに気づくでしょう。これは、Hibernate ORM が歴史的な理由からその「データアクセス」層を「JDBC」と呼んでいるためです。Hibernate Reactive は、そのデータアクセス層に JDBC ではなく Vert.x Reactive SQL クライアントを使用します。 それらの名前に関わらず、これらのプロパティーは Hibernate Reactive でも意味を持ちます。 |
ビルド時に固定される設定プロパティー - 他のすべての設定プロパティーは実行時にオーバーライド可能
Configuration property |
型 |
デフォルト |
||
|---|---|---|---|---|
Whether Hibernate ORM is enabled during the build. If Hibernate ORM is disabled during the build, all processing related to Hibernate ORM will be skipped,
but it will not be possible to activate Hibernate ORM at runtime:
Environment variable: Show more |
boolean |
|
||
Whether Hibernate ORM is working in blocking mode. Hibernate ORM’s blocking Environment variable: Show more |
boolean |
|
||
If Environment variable: Show more |
boolean |
|
||
Whether statistics collection is enabled. If 'metrics.enabled' is true, then the default here is considered true, otherwise the default is false. Environment variable: Show more |
boolean |
|||
Whether session metrics should be appended into the server log for each Hibernate session. This only has effect if statistics are enabled ( Environment variable: Show more |
boolean |
|||
Whether metrics are published if a metrics extension is enabled. Environment variable: Show more |
boolean |
|
||
Allow hql queries in the Dev UI page Environment variable: Show more |
boolean |
|
||
Enable or disable access to a Hibernate ORM Environment variable: Show more |
boolean |
|
||
The name of the datasource which this persistence unit uses. If undefined, it will use the default datasource. Environment variable: Show more |
string |
|||
The packages in which the entities affected to this persistence unit are located. Environment variable: Show more |
文字列のリスト |
|||
Paths to files containing the SQL statements to execute when Hibernate ORM starts. The files are retrieved from the classpath resources,
so they must be located in the resources directory (e.g. The default value for this setting differs depending on the Quarkus launch mode:
If you need different SQL statements between dev mode, test ( application.properties
Environment variable: Show more |
文字列のリスト |
|
||
Pluggable strategy contract for applying physical naming rules for database object names. Class name of the Hibernate PhysicalNamingStrategy implementation Environment variable: Show more |
string |
|||
Pluggable strategy for applying implicit naming rules when an explicit name is not given. Class name of the Hibernate ImplicitNamingStrategy implementation Environment variable: Show more |
string |
|||
XML files to configure the entity mapping, e.g. Defaults to Environment variable: Show more |
文字列のリスト |
|
||
Identifiers can be quoted using one of the available strategies. Set to Environment variable: Show more |
|
|
||
The default in Quarkus is for 2nd level caching to be enabled, and a good implementation is already integrated for you. Just cherry-pick which entities should be using the cache. Set this to false to disable all 2nd level caches. Environment variable: Show more |
boolean |
|
||
Defines how the Bean Validation integration behaves. Environment variable: Show more |
list of |
|
||
Defines the method for multi-tenancy (DATABASE, NONE, SCHEMA). The complete list of allowed values is available in the Hibernate ORM JavaDoc. The type DISCRIMINATOR is currently not supported. The default value is NONE (no multi-tenancy). Environment variable: Show more |
string |
|||
If hibernate is not auto generating the schema, and Quarkus is running in development mode then Quarkus will attempt to validate the database after startup and print a log message if there are any problems. Environment variable: Show more |
boolean |
|
||
Whether this persistence unit should be active at runtime. Note that if Hibernate ORM is disabled (i.e. Environment variable: Show more |
boolean |
|
||
Properties that should be passed on directly to Hibernate ORM.
Use the full configuration property key here,
for instance
Consider using a supported configuration property before falling back to unsupported ones. If none exists, make sure to file a feature request so that a supported configuration property can be added to Quarkus, and more importantly so that the configuration property is tested regularly. Environment variable: Show more |
Map<String,String> |
|||
This property is deprecated: The size of the batches used when loading entities and collections.
Environment variable: Show more |
int |
|
||
This property is deprecated: The maximum depth of outer join fetch tree for single-ended associations (one-to-one, many-to-one). A Environment variable: Show more |
int |
|||
This property is deprecated. Class name of a custom
Environment variable: Show more |
string |
|||
This property is deprecated since Enables the Bean Validation integration. Environment variable: Show more |
boolean |
|
||
This property is deprecated: Use Defines the name of the datasource to use in case of SCHEMA approach. The datasource of the persistence unit will be used if not set. Environment variable: Show more |
string |
|||
型 |
デフォルト |
|||
When set, attempts to exchange data with the database as the given version of Hibernate ORM would have, on a best-effort basis. Please note:
Environment variable: Show more |
|
|
||
The charset of the database. Used for DDL generation and also for the SQL import scripts. Environment variable: Show more |
|
|||
The default catalog to use for the database objects. Environment variable: Show more |
string |
|||
The default schema to use for the database objects. Environment variable: Show more |
string |
|||
Whether Hibernate ORM should check on startup
that the version of the database matches the version configured on the dialect
(either the default version, or the one set through This should be set to Environment variable: Show more |
boolean |
|
||
Instructs Hibernate ORM to avoid connecting to the database on startup. When starting offline: * Hibernate ORM will not attempt to create a schema automatically, so it must already be created when the application hits the database for the first time. * Quarkus will not check that the database version matches the one configured at build time. Environment variable: Show more |
boolean |
|
||
型 |
デフォルト |
|||
How the default JSON/XML format mappers are configured. Only available to mitigate migration from the current Quarkus-preconfigured format mappers (that will be removed in the future version). Environment variable: Show more |
|
|
||
How to store timezones in the database by default for properties of type Environment variable: Show more |
|
|
||
The optimizer to apply to identifier generators whose optimizer is not configured explicitly. Only relevant for table- and sequence-based identifier generators. Other generators, such as UUID-based generators, will ignore this setting. The optimizer is responsible for pooling new identifier values, in order to reduce the frequency of database calls to retrieve those values and thereby improve performance. Environment variable: Show more |
|
|
||
The preferred JDBC type to use for storing {@link java.time.Duration} values.
<p>
Can be overridden locally using Environment variable: Show more |
string |
|
||
The preferred JDBC type to use for storing {@link java.time.Instant} values.
<p>
Can be overridden locally using Environment variable: Show more |
string |
|
||
The preferred JDBC type to use for storing boolean values.
<p>
Can be overridden locally using Environment variable: Show more |
string |
|
||
The preferred JDBC type to use for storing {@link java.util.UUID} values.
<p>
Can be overridden locally using Environment variable: Show more |
string |
|
||
型 |
デフォルト |
|||
Name of the Hibernate ORM dialect. For supported databases, this property does not need to be set explicitly: it is selected automatically based on the datasource, and configured using the DB version set on the datasource to benefit from the best performance and latest features. If your database does not have a corresponding Quarkus extension, you will need to set this property explicitly. In that case, keep in mind that the JDBC driver and Hibernate ORM dialect may not work properly in GraalVM native executables. For built-in dialects, the expected value is one of the names
in the official list of dialects,
without the For third-party dialects, the expected value is the fully-qualified class name,
for example Environment variable: Show more |
string |
|
||
Specifies the bytes per character to use based on the database’s configured charset. Environment variable: Show more |
int |
|
||
Specifies whether the Environment variable: Show more |
boolean |
|
||
The storage engine to use. Environment variable: Show more |
string |
|||
Specifies the bytes per character to use based on the database’s configured charset. Environment variable: Show more |
int |
|
||
Specifies whether the Environment variable: Show more |
boolean |
|
||
The storage engine to use. Environment variable: Show more |
string |
|||
Support for Oracle’s MAX_STRING_SIZE = EXTENDED. Environment variable: Show more |
boolean |
|
||
Specifies whether this database is running on an Autonomous Database Cloud Service. Environment variable: Show more |
boolean |
|
||
Specifies whether this database is accessed using a database service protected by Application Continuity. Environment variable: Show more |
boolean |
|
||
The Environment variable: Show more |
string |
|||
型 |
デフォルト |
|||
The maximum size of the query plan cache. see # Environment variable: Show more |
int |
|
||
Default precedence of null values in Valid values are: Environment variable: Show more |
|
|
||
Enables IN clause parameter padding which improves statement caching. Environment variable: Show more |
boolean |
|
||
When limits cannot be applied on the database side, trigger an exception instead of attempting badly-performing in-memory result set limits. When pagination is used in combination with a fetch join applied to a collection or many-valued association, the limit must be applied in-memory instead of on the database. This should be avoided as it typically has terrible performance characteristics. Environment variable: Show more |
boolean |
|
||
型 |
デフォルト |
|||
The time zone pushed to the JDBC driver. See Environment variable: Show more |
string |
|||
How many rows are fetched at a time by the JDBC driver. Environment variable: Show more |
int |
|||
The number of updates (inserts, updates and deletes) that are sent by the JDBC driver at one time for execution. Environment variable: Show more |
int |
|||
型 |
デフォルト |
|||
The size of the batches used when loading entities and collections.
Environment variable: Show more |
int |
|
||
The maximum depth of outer join fetch tree for single-ended associations (one-to-one, many-to-one). A Environment variable: Show more |
int |
|||
型 |
デフォルト |
|||
The maximum time before an object of the cache is considered expired. Environment variable: Show more |
|
|||
The maximum number of objects kept in memory in the cache. Environment variable: Show more |
長 |
|
||
型 |
デフォルト |
|||
Existing applications rely (implicitly or explicitly) on Hibernate ignoring any DiscriminatorColumn declarations on joined inheritance hierarchies. This setting allows these applications to maintain the legacy behavior of DiscriminatorColumn annotations being ignored when paired with joined inheritance. Environment variable: Show more |
boolean |
|
||
型 |
デフォルト |
|||
Logs SQL bind parameters. Setting it to true is obviously not recommended in production. Environment variable: Show more |
boolean |
|
||
Show SQL logs and format them nicely. Setting it to true is obviously not recommended in production. Environment variable: Show more |
boolean |
|
||
Format the SQL logs if SQL log is enabled Environment variable: Show more |
boolean |
|
||
Highlight the SQL logs if SQL log is enabled Environment variable: Show more |
boolean |
|
||
Whether JDBC warnings should be collected and logged. Environment variable: Show more |
boolean |
|
||
If set, Hibernate will log queries that took more than specified number of milliseconds to execute. Environment variable: Show more |
長 |
|||
型 |
デフォルト |
|||
Select whether the database schema is generated or not.
This defaults to 'none'. However if Dev Services is in use and no other extensions that manage the schema are present the value will be automatically overridden to 'drop-and-create'. Accepted values: Environment variable: Show more |
|
|
||
If Hibernate ORM should create the schemas automatically (for databases supporting them). Environment variable: Show more |
boolean |
|
||
Whether we should stop on the first error when applying the schema. Environment variable: Show more |
boolean |
|
||
Additional database object types to include in schema management operations. By default, Hibernate ORM only considers tables and sequences when performing schema management operations. This setting allows you to specify additional database object types that should be included, such as "MATERIALIZED VIEW", "VIEW", or other database-specific object types. The exact supported values depend on the underlying database and dialect. Environment variable: Show more |
string |
|||
型 |
デフォルト |
|||
Select whether the database schema DDL files are generated or not. Accepted values: Environment variable: Show more |
|
|
||
Filename or URL where the database create DDL file should be generated. Environment variable: Show more |
string |
|||
Filename or URL where the database drop DDL file should be generated. Environment variable: Show more |
string |
|||
型 |
デフォルト |
|||
The default flushing strategy, or when to flush entities to the database in a Hibernate session: before every query, on commit, … This default can be overridden on a per-session basis with See the javadoc of Environment variable: Show more |
|
|
|
期間フォーマットについて
期間の値を書くには、標準の 数字で始まる簡略化した書式を使うこともできます:
その他の場合は、簡略化されたフォーマットが解析のために
|