Using Hibernate Reactive
previewHibernate 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 clone https://github.com/quarkusio/quarkus-quickstarts.git で Git リポジトリーをクローンします。または、https://github.com/quarkusio/quarkus-quickstarts/archive/main.zip[アーカイブ] をダウンロードします。
ソリューションは 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.propertiesquarkus.datasource.db-kind = postgresql (1)
%prod.quarkus.datasource.username = hibernate
%prod.quarkus.datasource.password = hibernate
%prod.quarkus.datasource.reactive.url = vertx-reactive:postgresql://localhost/quarkus_test (2)
%prod.quarkus.hibernate-orm.schema-management.strategy=create (3)
| 1 | Configure the datasource for production, relying on Dev Services for connection information in tests / dev mode. |
| 2 | Hibernate ORMの設定と唯一異なるプロパティ |
| 3 | Configure Hibernate ORM to create the schema on startup in production, which is useful for experimentation, but rely on convenient defaults in tests / dev mode. |
これらの設定プロパティは、典型的なHibernate Reactive設定ファイルにあるものと同じではないことに注意してください。これらはしばしばHibernate Reactive設定プロパティにマッピングされますが、名前が異なる可能性があり、必ずしも1対1でマッピングされるわけではありません。
ブロッキング (非リアクティブ) 設定とリアクティブ設定は 同じプロジェクト内で混在させることができます。
Configuring Hibernate Reactive using the standard persistence.xml configuration file is not supported.
|
application.properties で設定できるプロパティーのリストについては、Hibernate Reactive の設定リファレンス のセクションを参照してください。
プロジェクトの依存関係の中にHibernate Reactiveエクステンションがリストアップされていれば、Quarkus datasource の設定に基づいて Mutiny.SessionFactory が作成されます。
dialectは、Reactive SQLクライアントに基づいて選択されます(明示的に設定しない限り)。
| For more information on dialect selection and database versions, see the corresponding section of the Hibernate ORM guide. |
その後、 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() はコミット時に自動的にフラッシュされます。 |
Make sure to wrap methods modifying your database (e.g. session.persist(entity)) within a transaction.
|
@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 and Hibernate Reactive won’t share the same persistence context, so it’s recommended you stick to one or the other in a given method. For example use Hibernate ORM in blocking REST endpoints, and use Hibernate Reactive in reactive REST endpoints. |
-
両方のエクステンションを同時に使用するには、
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.jdbc.enabled=false
Quarkus は多くの Hibernate Reactive の設定を自動的に行い、多くの場合、より現代的なデフォルトを使用します。
CDI統合
QuarkusでHibernate Reactiveを使用することに慣れている方は、CDIを使用して Mutiny.SessionFactory を注入したことがあると思います。
@Inject
Mutiny.SessionFactory sessionFactory;
これにより、デフォルトの永続化ユニットの Mutiny.SessionFactory が注入されます。
Prior to Quarkus 3.0 it was also possible to inject a @RequestScoped bean for Mutiny.Session. However, the lifecycle of a reactive session does not fit the lifecycle of the CDI request context. Therefore, this bean is removed in Quarkus 3.0.
|
永続化ユニットのアクティブ化/非アクティブ化
永続化ユニットがビルド時に設定され、エンティティータイプまたは アクティブなデータソース が割り当てられている場合、永続化ユニットはデフォルトでアクティブになります。Quarkus は、アプリケーションの起動時に対応する Hibernate Reactive SessionFactory を開始します。
実行時に永続化ユニットを非アクティブ化するには、Hibernate ORM ガイドの該当セクション を参照してください。
|
Hibernate ORM ガイドの例に従って、アクティブな永続化ユニットのカスタム CDI Bean を宣言し、Hibernate Reactive を使用する場合は、 詳細については、CDI統合 を参照してください。 |
スキーマを管理するためのFlywayへの自動移行
Hibernate Reactive は Flyway と同じアプリケーションで使用できます。 リアクティブアプリケーションでの 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の使用
These classes are provided by the quarkus-test-vertx dependency.
|
非常にシンプルな使用例は、次のようになります:
@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));
}
}
See the Javadoc of UniAsserter for a full description of the various methods that can be used for creating assertions.
|
|
また、
|
複数の永続化ユニット
複数の永続化ユニットの設定
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はいくつかのコンポーネントを自動的に設定し、いくつかの拡張ポイントにカスタム実装を注入しています。
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 |
|
||
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 since Whether Hibernate ORM is working in blocking mode. Hibernate ORM’s blocking Environment variable: Show more |
boolean |
|
||
This property is deprecated: Use The size of the batches used when loading entities and collections.
Environment variable: Show more |
int |
|
||
This property is deprecated: Use 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: Use 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. 組み込みダイアレクトの場合、指定できる値は ダイアレクトの公式リスト
にある名前のいずれかで、 サードパーティーのダイアレクトの場合、期待される値は完全修飾クラス名です。
たとえば 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 |
|
||
タイプ |
デフォルト |
|||
Whether to bootstrap a blocking (JDBC) Hibernate ORM instance for this persistence unit.
<p>
Use {@code quarkus.hibernate-orm.jdbc.enabled} for the default persistence unit
and {@code quarkus.hibernate-orm."<persistence-unit-name>".jdbc.enabled} for named persistence units.
This is the per-persistence-unit replacement for the deprecated {@code quarkus.hibernate-orm.blocking}.
<p>
If not set, this is inferred from whether a JDBC datasource is available for this persistence unit,
as well as the global (deprecated) 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 |
|||
タイプ |
デフォルト |
|||
Whether to bootstrap a reactive Hibernate Reactive instance for this persistence unit. <p> Use {@code quarkus.hibernate-orm.reactive.enabled} for the default persistence unit and {@code quarkus.hibernate-orm."<persistence-unit-name>".reactive.enabled} for named persistence units. <p> If not set, this is inferred from whether a reactive datasource is available for this persistence unit. Environment variable: Show more |
boolean |
|||
タイプ |
デフォルト |
|||
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. Mutually exclusive with Environment variable: Show more |
long |
|
||
The maximum total weight of objects kept in memory in the cache. When set, eviction is based on the total weight of cached entries rather than their count. This is useful for entities with highly variable sizes (e.g., JSON blobs). Mutually exclusive with Environment variable: Show more |
long |
|||
The fully qualified class name of a Only used when Environment variable: Show more |
string |
|||
タイプ |
デフォルト |
|||
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 |
long |
|||
タイプ |
デフォルト |
|||
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 |
|
|
|
期間フォーマットについて
期間の値を書くには、標準の 数字で始まる簡略化した書式を使うこともできます:
その他の場合は、簡略化されたフォーマットが解析のために
|