The English version of quarkus.io is the official project site. Translated sites are community supported on a best-effort basis.
このページを編集

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 は、いくつかの定見に基づいた選択と経験に基づいた推測を行います。

以下の依存関係をプロジェクトに追加してください:

例えば:

pom.xml
<!-- 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>
build.gradle
// 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 を注入することができます:

Hibernate Reactive を使用したアプリケーション Bean の例
@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:

Example REST resource using @Transactional
@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 Uni completes successfully

  • Roll back the transaction if an exception is thrown or the Uni is cancelled

  • Close the session and release the database connection when the reactive chain completes

There are some limitations when using @Transactional with Hibernate Reactive, in particular not being able to use a specific TxType, not being able to use multiple persistence units / datasources, or non-functional Uni.combine()/Uni.joining().

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 を使用する場合は、Session 型の代わりに Mutiny.SessionFactory 型を使用するようにしてください。これは、Hibernate Reactive の API エントリーポイントが Hibernate ORM と異なる点の1つです。

詳細については、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 を参照してください。

また、io.quarkus.test.vertx.UniAsserterInterceptor を拡張して、注入された UniAsserter をラップし、デフォルトの挙動をカスタマイズすることもできます。たとえば、インターセプターを使用して、アサートメソッドを個別のデータベーストランザクション内で実行することができます。

@QuarkusTest
public class SomeTest {

   @Test
   @RunOnVertxContext
   public void testEntity(UniAsserter asserter) {
      asserter = new UniAsserterInterceptor(asserter) {
         @Override
         protected <T> Supplier<Uni<T>> transformUni(Supplier<Uni<T>> uniSupplier) {
            return () -> Panache.withTransaction(uniSupplier);
         }
      };
      asserter.execute(() -> new MyEntity().persist());
      asserter.assertEquals(() -> MyEntity.count(), 1l);
      asserter.execute(() -> MyEntity.deleteAll());
   }
}

複数の永続化ユニット

複数の永続化ユニットの設定

Hibernate ORM と同様に、Hibernate Reactive は複数の永続化ユニットをサポートしています。

複数の永続化ユニットとデータソースを定義でき、それらはブロッキングと Reactive のデータソースを混在させることができます。データソースが Reactive をサポートしていることを確認するには、reactive プロパティーを true に設定する必要があります。

例:application.properties
quarkus.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

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:

  1. Use jakarta.transaction.Transactional for declarative transaction management

  2. Use Panache’s transaction annotations (@WithTransaction, @WithSession, @WithSessionOnDemand, or the programmatic Panache.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: quarkus.hibernate-orm.active will default to false and setting it to true will lead to an error.

Environment variable: QUARKUS_HIBERNATE_ORM_ENABLED

Show more

boolean

true

Whether Hibernate ORM is working in blocking mode.

Hibernate ORM’s blocking EntityManager/Session/SessionFactory are normally disabled by default if no JDBC datasource is found. You can set this property to false if you want to disable them despite having a JDBC datasource.

Environment variable: QUARKUS_HIBERNATE_ORM_BLOCKING

Show more

boolean

true

If true, Quarkus will ignore any persistence.xml file in the classpath and rely exclusively on the Quarkus configuration.

Environment variable: QUARKUS_HIBERNATE_ORM_PERSISTENCE_XML_IGNORE

Show more

boolean

false

Whether statistics collection is enabled. If 'metrics.enabled' is true, then the default here is considered true, otherwise the default is false.

Environment variable: QUARKUS_HIBERNATE_ORM_STATISTICS

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 (quarkus.hibernate-orm.statistics). The default is false (which means both statistics and log-session-metrics need to be enabled for the session metrics to appear in the log).

Environment variable: QUARKUS_HIBERNATE_ORM_LOG_SESSION_METRICS

Show more

boolean

Whether metrics are published if a metrics extension is enabled.

Environment variable: QUARKUS_HIBERNATE_ORM_METRICS_ENABLED

Show more

boolean

false

Allow hql queries in the Dev UI page

Environment variable: QUARKUS_HIBERNATE_ORM_DEV_UI_ALLOW_HQL

Show more

boolean

false

Enable or disable access to a Hibernate ORM EntityManager/Session/StatelessSession *when no transaction is active* but a request scope is. When enabled, the corresponding sessions will be read-only. Defaults to enabled for backwards compatibility, but disabling this is recommended, to avoid inconsistent resulsts caused by queries running outside of transactions.

Environment variable: QUARKUS_HIBERNATE_ORM_REQUEST_SCOPED_ENABLED

Show more

boolean

true

quarkus.hibernate-orm."persistence-unit-name".datasource

The name of the datasource which this persistence unit uses.

If undefined, it will use the default datasource.

Environment variable: QUARKUS_HIBERNATE_ORM_DATASOURCE

Show more

string

quarkus.hibernate-orm."persistence-unit-name".packages

The packages in which the entities affected to this persistence unit are located.

Environment variable: QUARKUS_HIBERNATE_ORM_PACKAGES

Show more

文字列のリスト

quarkus.hibernate-orm."persistence-unit-name".sql-load-script

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. src/main/resources).

The default value for this setting differs depending on the Quarkus launch mode:

  • In dev and test modes, it defaults to import.sql. Simply add an import.sql file in the root of your resources directory and it will be picked up without having to set this property. Pass no-file to force Hibernate ORM to ignore the SQL import file.

  • In production mode, it defaults to no-file. It means Hibernate ORM won’t try to execute any SQL import file by default. Pass an explicit value to force Hibernate ORM to execute the SQL import file.

If you need different SQL statements between dev mode, test (@QuarkusTest) and in production, use Quarkus configuration profiles facility.

application.properties
%dev.quarkus.hibernate-orm.sql-load-script = import-dev.sql
%test.quarkus.hibernate-orm.sql-load-script = import-test.sql
%prod.quarkus.hibernate-orm.sql-load-script = no-file

Quarkus supports files with SQL statements or comments spread over multiple lines, or .zip files containing those files. Each SQL statement must be terminated by a semicolon.

Environment variable: QUARKUS_HIBERNATE_ORM_SQL_LOAD_SCRIPT

Show more

文字列のリスト

import.sql in dev and test modes ; no-file otherwise

quarkus.hibernate-orm."persistence-unit-name".physical-naming-strategy

Pluggable strategy contract for applying physical naming rules for database object names. Class name of the Hibernate PhysicalNamingStrategy implementation

Environment variable: QUARKUS_HIBERNATE_ORM_PHYSICAL_NAMING_STRATEGY

Show more

string

quarkus.hibernate-orm."persistence-unit-name".implicit-naming-strategy

Pluggable strategy for applying implicit naming rules when an explicit name is not given. Class name of the Hibernate ImplicitNamingStrategy implementation

Environment variable: QUARKUS_HIBERNATE_ORM_IMPLICIT_NAMING_STRATEGY

Show more

string

quarkus.hibernate-orm."persistence-unit-name".mapping-files

XML files to configure the entity mapping, e.g. META-INF/my-orm.xml.

Defaults to META-INF/orm.xml if it exists. Pass no-file to force Hibernate ORM to ignore META-INF/orm.xml.

Environment variable: QUARKUS_HIBERNATE_ORM_MAPPING_FILES

Show more

文字列のリスト

META-INF/orm.xml if it exists; no-file otherwise

quarkus.hibernate-orm."persistence-unit-name".quote-identifiers.strategy

Identifiers can be quoted using one of the available strategies.

Set to none by default, meaning no identifiers will be quoted. If set to all, all identifiers and column definitions will be quoted. Additionally, setting it to all-except-column-definitions will skip the column definitions, which can usually be required when they exist, or else use the option only-keywords to quote only identifiers deemed SQL keywords by the Hibernate ORM dialect.

Environment variable: QUARKUS_HIBERNATE_ORM_QUOTE_IDENTIFIERS_STRATEGY

Show more

noneIdentifiers are not quoted., allAll identifiers are quoted., all-except-column-definitionsAll identifiers, except column definitions, are quoted., only-keywordsOnly keywords will be quoted.

noneIdentifiers are not quoted.

quarkus.hibernate-orm."persistence-unit-name".second-level-caching-enabled

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: QUARKUS_HIBERNATE_ORM_SECOND_LEVEL_CACHING_ENABLED

Show more

boolean

true

quarkus.hibernate-orm."persistence-unit-name".validation.mode

Defines how the Bean Validation integration behaves.

Environment variable: QUARKUS_HIBERNATE_ORM_VALIDATION_MODE

Show more

list of autoIf a Bean Validation provider is present then behaves as if both ValidationMode#CALLBACK and ValidationMode#DDL modes are configured. Otherwise, same as ValidationMode#NONE., callbackBean Validation will perform the lifecycle event validation., ddlBean Validation constraints will be considered for the DDL operations., noneBean Validation integration will be disabled.

auto

quarkus.hibernate-orm."persistence-unit-name".multitenant

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: QUARKUS_HIBERNATE_ORM_MULTITENANT

Show more

string

quarkus.hibernate-orm."persistence-unit-name".validate-in-dev-mode

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: QUARKUS_HIBERNATE_ORM_VALIDATE_IN_DEV_MODE

Show more

boolean

true

quarkus.hibernate-orm."persistence-unit-name".active

Whether this persistence unit should be active at runtime.

Note that if Hibernate ORM is disabled (i.e. quarkus.hibernate-orm.enabled is set to false), all persistence units are deactivated, and setting this property to true will fail.

Environment variable: QUARKUS_HIBERNATE_ORM_ACTIVE

Show more

boolean

`true` if Hibernate ORM is enabled and there are entity types or an active datasource assigned to the persistence unit; `false` otherwise

quarkus.hibernate-orm."persistence-unit-name".unsupported-properties."full-property-key"

Properties that should be passed on directly to Hibernate ORM. Use the full configuration property key here, for instance quarkus.hibernate-orm.unsupported-properties."hibernate.order_inserts" = true.

Properties set here are completely unsupported: as Quarkus doesn’t generally know about these properties and their purpose, there is absolutely no guarantee that they will work correctly, and even if they do, that may change when upgrading to a newer version of Quarkus (even just a micro/patch version).

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: QUARKUS_HIBERNATE_ORM_UNSUPPORTED_PROPERTIES__FULL_PROPERTY_KEY_

Show more

Map<String,String>

quarkus.hibernate-orm."persistence-unit-name".batch-fetch-size

This property is deprecated: fetch should be used to configure fetching properties.

The size of the batches used when loading entities and collections.

-1 means batch loading is disabled.

Environment variable: QUARKUS_HIBERNATE_ORM_BATCH_FETCH_SIZE

Show more

int

16

quarkus.hibernate-orm."persistence-unit-name".max-fetch-depth

This property is deprecated: fetch should be used to configure fetching properties.

The maximum depth of outer join fetch tree for single-ended associations (one-to-one, many-to-one).

A 0 disables default outer join fetching.

Environment variable: QUARKUS_HIBERNATE_ORM_MAX_FETCH_DEPTH

Show more

int

quarkus.hibernate-orm."persistence-unit-name".metadata-builder-contributor

This property is deprecated.

Class name of a custom org.hibernate.boot.spi.MetadataBuilderContributor implementation.

Not all customization options exposed by org.hibernate.boot.MetadataBuilder will work correctly. Stay clear of options related to classpath scanning in particular.

This setting is exposed mainly to allow registration of types, converters and SQL functions.

  • @deprecated Use TypeContributor, FunctionContributor or AdditionalMappingContributor instead.

Environment variable: QUARKUS_HIBERNATE_ORM_METADATA_BUILDER_CONTRIBUTOR

Show more

string

quarkus.hibernate-orm."persistence-unit-name".validation.enabled

This property is deprecated since 3.19: Use mode() instead.

Enables the Bean Validation integration.

Environment variable: QUARKUS_HIBERNATE_ORM_VALIDATION_ENABLED

Show more

boolean

true

quarkus.hibernate-orm."persistence-unit-name".multitenant-schema-datasource

This property is deprecated: Use datasource() instead.

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: QUARKUS_HIBERNATE_ORM_MULTITENANT_SCHEMA_DATASOURCE

Show more

string

Database related configuration

デフォルト

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:

  • schema validation may still fail in some cases: this attempts to make Hibernate ORM 6+ behave correctly at runtime, but it may still expect a different (but runtime-compatible) schema.

  • robust test suites are still useful and recommended: you should still check that your application behaves as intended with your legacy schema.

  • this feature is inherently unstable: some aspects of it may stop working in future versions of Quarkus, and older versions will be dropped as Hibernate ORM changes pile up and support for those older versions becomes too unreliable.

  • you should still plan a migration of your schema to a newer version of Hibernate ORM. For help with migration, refer to the Quarkus 3 migration guide from Hibernate ORM 5 to 6.

Environment variable: QUARKUS_HIBERNATE_ORM_DATABASE_ORM_COMPATIBILITY_VERSION

Show more

5.6, latest

latest

quarkus.hibernate-orm."persistence-unit-name".database.charset

The charset of the database.

Used for DDL generation and also for the SQL import scripts.

Environment variable: QUARKUS_HIBERNATE_ORM_DATABASE_CHARSET

Show more

Charset

UTF-8

quarkus.hibernate-orm."persistence-unit-name".database.default-catalog

The default catalog to use for the database objects.

Environment variable: QUARKUS_HIBERNATE_ORM_DATABASE_DEFAULT_CATALOG

Show more

string

quarkus.hibernate-orm."persistence-unit-name".database.default-schema

The default schema to use for the database objects.

Environment variable: QUARKUS_HIBERNATE_ORM_DATABASE_DEFAULT_SCHEMA

Show more

string

quarkus.hibernate-orm."persistence-unit-name".database.version-check.enabled

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 quarkus.datasource.db-version).

This should be set to false if the database is not available on startup.

Environment variable: QUARKUS_HIBERNATE_ORM_DATABASE_VERSION_CHECK_ENABLED

Show more

boolean

`false` if starting offline (see `start-offline`), `true` otherwise

quarkus.hibernate-orm."persistence-unit-name".database.start-offline

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: QUARKUS_HIBERNATE_ORM_DATABASE_START_OFFLINE

Show more

boolean

false

JSON/XML mapping related configuration

デフォルト

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: QUARKUS_HIBERNATE_ORM_MAPPING_FORMAT_GLOBAL

Show more

ignore, warn, fail

fail

quarkus.hibernate-orm."persistence-unit-name".mapping.timezone.default-storage

How to store timezones in the database by default for properties of type OffsetDateTime and ZonedDateTime. This default may be overridden on a per-property basis using @TimeZoneStorage. NOTE: Properties of type OffsetTime are https://hibernate.atlassian.net/browse/HHH-16287[not affected by this setting].

Environment variable: QUARKUS_HIBERNATE_ORM_MAPPING_TIMEZONE_DEFAULT_STORAGE

Show more

nativeStores the timestamp and timezone in a column of type timestamp with time zone. Only available on some databases/dialects; if not supported, an exception will be thrown during static initialization., normalizeDoes not store the timezone, and loses timezone information upon persisting. Instead, normalizes the value\: * upon persisting to the database, to a timestamp in the JDBC timezone set through quarkus.hibernate-orm.jdbc.timezone, or the JVM default timezone if not set. * upon reading back from the database, to the JVM default timezone. Use this to get the legacy behavior of Quarkus 2 / Hibernate ORM 5 or older., normalize-utcDoes not store the timezone, and loses timezone information upon persisting. Instead, normalizes the value to a timestamp in the UTC timezone., columnStores the timezone in a separate column next to the timestamp column. Use @TimeZoneColumn on the relevant entity property to customize the timezone column., autoEquivalent to native if supported, column otherwise., defaultEquivalent to native if supported, normalize-utc otherwise.

defaultEquivalent to native if supported, normalize-utc otherwise.

quarkus.hibernate-orm."persistence-unit-name".mapping.id.optimizer.default

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: QUARKUS_HIBERNATE_ORM_MAPPING_ID_OPTIMIZER_DEFAULT

Show more

pooled-loAssumes the value retrieved from the table/sequence is the lower end of the pool. Upon retrieving value N, the new pool of identifiers will go from N to N + <allocation size> - 1, inclusive., pooledAssumes the value retrieved from the table/sequence is the higher end of the pool. Upon retrieving value N, the new pool of identifiers will go from N - <allocation size> to N + <allocation size> - 1, inclusive. The first value, 1, is handled differently to avoid negative identifiers. Use this to get the legacy behavior of Quarkus 2 / Hibernate ORM 5 or older., noneNo optimizer, resulting in a database call each and every time an identifier value is needed from the generator. Not recommended in production environments\: may result in degraded performance and/or frequent gaps in identifier values.

pooled-loAssumes the value retrieved from the table/sequence is the lower end of the pool. Upon retrieving value N, the new pool of identifiers will go from N to N + <allocation size> - 1, inclusive.

quarkus.hibernate-orm."persistence-unit-name".mapping.duration.preferred-jdbc-type

The preferred JDBC type to use for storing {@link java.time.Duration} values. <p> Can be overridden locally using @JdbcType, @JdbcTypeCode, and similar annotations. <p> Can also specify the name of the SqlTypes constant field, for example, quarkus.hibernate-orm.mapping.type.preferred_jdbc_type=INTERVAL_SECOND.

Environment variable: QUARKUS_HIBERNATE_ORM_MAPPING_DURATION_PREFERRED_JDBC_TYPE

Show more

string

INTERVAL_SECOND

quarkus.hibernate-orm."persistence-unit-name".mapping.instant.preferred-jdbc-type

The preferred JDBC type to use for storing {@link java.time.Instant} values. <p> Can be overridden locally using @JdbcType, @JdbcTypeCode, and similar annotations. <p> Can also specify the name of the SqlTypes constant field, for example, quarkus.hibernate-orm.mapping.instant.preferred-jdbc-type=TIMESTAMP or quarkus.hibernate-orm.mapping.instant.preferred-jdbc-type=INSTANT.

Environment variable: QUARKUS_HIBERNATE_ORM_MAPPING_INSTANT_PREFERRED_JDBC_TYPE

Show more

string

TIMESTAMP

quarkus.hibernate-orm."persistence-unit-name".mapping.boolean.preferred-jdbc-type

The preferred JDBC type to use for storing boolean values. <p> Can be overridden locally using @JdbcType, @JdbcTypeCode, and similar annotations. <p> Can also specify the name of the SqlTypes constant field, for example, quarkus.hibernate-orm.mapping.boolean.preferred-jdbc-type=BIT.

Environment variable: QUARKUS_HIBERNATE_ORM_MAPPING_BOOLEAN_PREFERRED_JDBC_TYPE

Show more

string

BOOLEAN

quarkus.hibernate-orm."persistence-unit-name".mapping.uuid.preferred-jdbc-type

The preferred JDBC type to use for storing {@link java.util.UUID} values. <p> Can be overridden locally using @JdbcType, @JdbcTypeCode, and similar annotations. <p> Can also specify the name of the SqlTypes constant field, for example, quarkus.hibernate-orm.mapping.uuid.preferred-jdbc-type=CHAR.

Environment variable: QUARKUS_HIBERNATE_ORM_MAPPING_UUID_PREFERRED_JDBC_TYPE

Show more

string

UUID

Dialect related configuration

デフォルト

quarkus.hibernate-orm."persistence-unit-name".dialect

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 Dialect suffix, for example Cockroach for CockroachDialect.

For third-party dialects, the expected value is the fully-qualified class name, for example com.acme.hibernate.AcmeDbDialect.

Environment variable: QUARKUS_HIBERNATE_ORM_DIALECT

Show more

string

selected automatically for most popular databases

quarkus.hibernate-orm."persistence-unit-name".dialect.mariadb.bytes-per-character

Specifies the bytes per character to use based on the database’s configured charset.

Environment variable: QUARKUS_HIBERNATE_ORM_DIALECT_MARIADB_BYTES_PER_CHARACTER

Show more

int

4

quarkus.hibernate-orm."persistence-unit-name".dialect.mariadb.no-backslash-escapes

Specifies whether the NO_BACKSLASH_ESCAPES sql mode is enabled.

Environment variable: QUARKUS_HIBERNATE_ORM_DIALECT_MARIADB_NO_BACKSLASH_ESCAPES

Show more

boolean

false

quarkus.hibernate-orm."persistence-unit-name".dialect.mariadb.storage-engine

The storage engine to use.

Environment variable: QUARKUS_HIBERNATE_ORM_DIALECT_MARIADB_STORAGE_ENGINE

Show more

string

quarkus.hibernate-orm."persistence-unit-name".dialect.mysql.bytes-per-character

Specifies the bytes per character to use based on the database’s configured charset.

Environment variable: QUARKUS_HIBERNATE_ORM_DIALECT_MYSQL_BYTES_PER_CHARACTER

Show more

int

4

quarkus.hibernate-orm."persistence-unit-name".dialect.mysql.no-backslash-escapes

Specifies whether the NO_BACKSLASH_ESCAPES sql mode is enabled.

Environment variable: QUARKUS_HIBERNATE_ORM_DIALECT_MYSQL_NO_BACKSLASH_ESCAPES

Show more

boolean

false

quarkus.hibernate-orm."persistence-unit-name".dialect.mysql.storage-engine

The storage engine to use.

Environment variable: QUARKUS_HIBERNATE_ORM_DIALECT_MYSQL_STORAGE_ENGINE

Show more

string

quarkus.hibernate-orm."persistence-unit-name".dialect.oracle.extended

Support for Oracle’s MAX_STRING_SIZE = EXTENDED.

Environment variable: QUARKUS_HIBERNATE_ORM_DIALECT_ORACLE_EXTENDED

Show more

boolean

false

quarkus.hibernate-orm."persistence-unit-name".dialect.oracle.autonomous

Specifies whether this database is running on an Autonomous Database Cloud Service.

Environment variable: QUARKUS_HIBERNATE_ORM_DIALECT_ORACLE_AUTONOMOUS

Show more

boolean

false

quarkus.hibernate-orm."persistence-unit-name".dialect.oracle.application-continuity

Specifies whether this database is accessed using a database service protected by Application Continuity.

Environment variable: QUARKUS_HIBERNATE_ORM_DIALECT_ORACLE_APPLICATION_CONTINUITY

Show more

boolean

false

quarkus.hibernate-orm."persistence-unit-name".dialect.mssql.compatibility-level

The compatibility_level as defined in sys.databases.

Environment variable: QUARKUS_HIBERNATE_ORM_DIALECT_MSSQL_COMPATIBILITY_LEVEL

Show more

string

Query related configuration

デフォルト

quarkus.hibernate-orm."persistence-unit-name".query.query-plan-cache-max-size

The maximum size of the query plan cache. see #org.hibernate.cfg.AvailableSettings#QUERY_PLAN_CACHE_MAX_SIZE

Environment variable: QUARKUS_HIBERNATE_ORM_QUERY_QUERY_PLAN_CACHE_MAX_SIZE

Show more

int

2048

quarkus.hibernate-orm."persistence-unit-name".query.default-null-ordering

Default precedence of null values in ORDER BY clauses.

Valid values are: none, first, last.

Environment variable: QUARKUS_HIBERNATE_ORM_QUERY_DEFAULT_NULL_ORDERING

Show more

noneNull precedence not specified., firstNull values occur at the beginning of the ORDER BY clause., lastNull values occur at the end of the ORDER BY clause.

noneNull precedence not specified.

quarkus.hibernate-orm."persistence-unit-name".query.in-clause-parameter-padding

Enables IN clause parameter padding which improves statement caching.

Environment variable: QUARKUS_HIBERNATE_ORM_QUERY_IN_CLAUSE_PARAMETER_PADDING

Show more

boolean

true

quarkus.hibernate-orm."persistence-unit-name".query.fail-on-pagination-over-collection-fetch

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: QUARKUS_HIBERNATE_ORM_QUERY_FAIL_ON_PAGINATION_OVER_COLLECTION_FETCH

Show more

boolean

false

JDBC related configuration

デフォルト

quarkus.hibernate-orm."persistence-unit-name".jdbc.timezone

The time zone pushed to the JDBC driver. See quarkus.hibernate-orm.mapping.timezone.default-storage.

Environment variable: QUARKUS_HIBERNATE_ORM_JDBC_TIMEZONE

Show more

string

quarkus.hibernate-orm."persistence-unit-name".jdbc.statement-fetch-size

How many rows are fetched at a time by the JDBC driver.

Environment variable: QUARKUS_HIBERNATE_ORM_JDBC_STATEMENT_FETCH_SIZE

Show more

int

quarkus.hibernate-orm."persistence-unit-name".jdbc.statement-batch-size

The number of updates (inserts, updates and deletes) that are sent by the JDBC driver at one time for execution.

Environment variable: QUARKUS_HIBERNATE_ORM_JDBC_STATEMENT_BATCH_SIZE

Show more

int

Fetching logic configuration

デフォルト

quarkus.hibernate-orm."persistence-unit-name".fetch.batch-size

The size of the batches used when loading entities and collections.

-1 means batch loading is disabled.

Environment variable: QUARKUS_HIBERNATE_ORM_FETCH_BATCH_SIZE

Show more

int

16

quarkus.hibernate-orm."persistence-unit-name".fetch.max-depth

The maximum depth of outer join fetch tree for single-ended associations (one-to-one, many-to-one).

A 0 disables default outer join fetching.

Environment variable: QUARKUS_HIBERNATE_ORM_FETCH_MAX_DEPTH

Show more

int

Caching configuration

デフォルト

quarkus.hibernate-orm."persistence-unit-name".cache."cache".expiration.max-idle

The maximum time before an object of the cache is considered expired.

Environment variable: QUARKUS_HIBERNATE_ORM_CACHE__CACHE__EXPIRATION_MAX_IDLE

Show more

Duration 

100s

quarkus.hibernate-orm."persistence-unit-name".cache."cache".memory.object-count

The maximum number of objects kept in memory in the cache.

Environment variable: QUARKUS_HIBERNATE_ORM_CACHE__CACHE__MEMORY_OBJECT_COUNT

Show more

10000

Discriminator related configuration

デフォルト

quarkus.hibernate-orm."persistence-unit-name".discriminator.ignore-explicit-for-joined

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: QUARKUS_HIBERNATE_ORM_DISCRIMINATOR_IGNORE_EXPLICIT_FOR_JOINED

Show more

boolean

false

Logging configuration

デフォルト

Logs SQL bind parameters.

Setting it to true is obviously not recommended in production.

Environment variable: QUARKUS_HIBERNATE_ORM_LOG_BIND_PARAMETERS

Show more

boolean

false

quarkus.hibernate-orm."persistence-unit-name".log.sql

Show SQL logs and format them nicely.

Setting it to true is obviously not recommended in production.

Environment variable: QUARKUS_HIBERNATE_ORM_LOG_SQL

Show more

boolean

false

quarkus.hibernate-orm."persistence-unit-name".log.format-sql

Format the SQL logs if SQL log is enabled

Environment variable: QUARKUS_HIBERNATE_ORM_LOG_FORMAT_SQL

Show more

boolean

true

quarkus.hibernate-orm."persistence-unit-name".log.highlight-sql

Highlight the SQL logs if SQL log is enabled

Environment variable: QUARKUS_HIBERNATE_ORM_LOG_HIGHLIGHT_SQL

Show more

boolean

true

quarkus.hibernate-orm."persistence-unit-name".log.jdbc-warnings

Whether JDBC warnings should be collected and logged.

Environment variable: QUARKUS_HIBERNATE_ORM_LOG_JDBC_WARNINGS

Show more

boolean

depends on dialect

quarkus.hibernate-orm."persistence-unit-name".log.queries-slower-than-ms

If set, Hibernate will log queries that took more than specified number of milliseconds to execute.

Environment variable: QUARKUS_HIBERNATE_ORM_LOG_QUERIES_SLOWER_THAN_MS

Show more

Schema management configuration

デフォルト

quarkus.hibernate-orm."persistence-unit-name".schema-management.strategy

Select whether the database schema is generated or not.

drop-and-create is awesome in development mode.

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: none, create, drop-and-create, drop, update, validate.

Environment variable: QUARKUS_HIBERNATE_ORM_SCHEMA_MANAGEMENT_STRATEGY

Show more

noneNo schema action., createCreate the schema., drop-and-createDrop and then recreate the schema., dropDrop the schema., updateUpdate (alter) the database schema., validateValidate the database schema.

noneNo schema action.

quarkus.hibernate-orm."persistence-unit-name".schema-management.create-schemas

If Hibernate ORM should create the schemas automatically (for databases supporting them).

Environment variable: QUARKUS_HIBERNATE_ORM_SCHEMA_MANAGEMENT_CREATE_SCHEMAS

Show more

boolean

false

quarkus.hibernate-orm."persistence-unit-name".schema-management.halt-on-error

Whether we should stop on the first error when applying the schema.

Environment variable: QUARKUS_HIBERNATE_ORM_SCHEMA_MANAGEMENT_HALT_ON_ERROR

Show more

boolean

false

quarkus.hibernate-orm."persistence-unit-name".schema-management.extra-physical-table-types

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: QUARKUS_HIBERNATE_ORM_SCHEMA_MANAGEMENT_EXTRA_PHYSICAL_TABLE_TYPES

Show more

string

Database scripts related configuration

デフォルト

quarkus.hibernate-orm."persistence-unit-name".scripts.generation

Select whether the database schema DDL files are generated or not. Accepted values: none, create, drop-and-create, drop, update, validate.

Environment variable: QUARKUS_HIBERNATE_ORM_SCRIPTS_GENERATION

Show more

noneNo schema action., createCreate the schema., drop-and-createDrop and then recreate the schema., dropDrop the schema., updateUpdate (alter) the database schema., validateValidate the database schema.

noneNo schema action.

quarkus.hibernate-orm."persistence-unit-name".scripts.generation.create-target

Filename or URL where the database create DDL file should be generated.

Environment variable: QUARKUS_HIBERNATE_ORM_SCRIPTS_GENERATION_CREATE_TARGET

Show more

string

quarkus.hibernate-orm."persistence-unit-name".scripts.generation.drop-target

Filename or URL where the database drop DDL file should be generated.

Environment variable: QUARKUS_HIBERNATE_ORM_SCRIPTS_GENERATION_DROP_TARGET

Show more

string

Flush configuration

デフォルト

quarkus.hibernate-orm."persistence-unit-name".flush.mode

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 Session#setHibernateFlushMode() or on a per-query basis with the hint HibernateHints#HINT_FLUSH_MODE.

See the javadoc of org.hibernate.FlushMode for details.

Environment variable: QUARKUS_HIBERNATE_ORM_FLUSH_MODE

Show more

manualThe org.hibernate.Session is only flushed when org.hibernate.Session#flush() is called explicitly. This mode is very efficient for read-only transactions., commitThe org.hibernate.Session is flushed when org.hibernate.Transaction#commit() is called. It is never automatically flushed before query execution., autoThe org.hibernate.Session is flushed when org.hibernate.Transaction#commit() is called, and is sometimes flushed before query execution in order to ensure that queries never return stale state. This is the default flush mode., alwaysThe org.hibernate.Session is flushed when org.hibernate.Transaction#commit() is called and before every query. This is usually unnecessary and inefficient.

autoThe org.hibernate.Session is flushed when org.hibernate.Transaction#commit() is called, and is sometimes flushed before query execution in order to ensure that queries never return stale state. This is the default flush mode.

期間フォーマットについて

期間の値を書くには、標準の java.time.Duration フォーマットを使います。 詳細は Duration#parse() Java API documentation を参照してください。

数字で始まる簡略化した書式を使うこともできます:

  • 数値のみの場合は、秒単位の時間を表します。

  • 数値の後に ms が続く場合は、ミリ秒単位の時間を表します。

その他の場合は、簡略化されたフォーマットが解析のために java.time.Duration フォーマットに変換されます:

  • 数値の後に hms が続く場合は、その前に PT が付けられます。

  • 数値の後に d が続く場合は、その前に P が付けられます。

関連コンテンツ