jpa-patterns
JPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.
Target: Design & content creation. Automatically collected · unverified.
Excerpt from the author’s documentation
Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.
Read the original Japanese text
Topics in the source
- JPA/Hibernate パターン
- エンティティ設計
- リレーションシップとN+1防止
- リポジトリパターン
- トランザクション
- ページネーション
- インデックス作成とパフォーマンス
- コネクションプーリング(HikariCP)
Spring Bootでのデータモデリング、リポジトリ、パフォーマンスチューニングに使用します。 監査を有効化: デフォルトで遅延ロード。必要に応じてクエリで JOIN FETCH を使用 コレクションでは EAGER を避け、読み取りパスにはDTOプロジェクションを使用 軽量クエリにはプロジェクションを使用: サービスメソッドに @Transactional を付ける 読み取りパスを最適化するために @Transactional(readOnly = true) を使用 伝播を慎重に選択。長時間実行されるトランザクションを避ける カーソルライクなページネーションには、順序付けでJPQLに id > :lastId を含める。 一般的なフィルタ(status、slug、外部キー)にインデックスを追加 クエリパターンに一致する複合インデックスを使用(status, createdat) select を避け、必要な列のみを投影 saveAll と hibernate.jdbc.batchsize でバッチ書き込み 推奨プロパティ: PostgreSQL LOB処理には、次を追加: 1次キャッシュはEntityManagerごと。トランザクション間でエンティティを保持しない 読み取り集約型エンティティには、2次キャッシュを慎重に検討。退避戦略を検証 FlywayまたはLiquibaseを使用。本番環境でHibernate自動DDLに依存しない マイグレーションを冪等かつ追加的に保つ。計画なしに列を削除しない 本番環境を反映するために、Testcontainersを使用した @DataJpaTest を優先 ログを使用してSQL効率をアサート: パラメータ値には logging.level.org.hibernate.SQL=DEBUG と logging.level.org.hibernate.orm.jdbc.bind=TRACE を設定 注意: エンティティを軽量に保ち、クエリを意図的にし、トランザクションを短く保ちます。フェッチ戦略とプロジェクションでN+1を防ぎ、読み取り/書き込みパスにインデックスを作成します。
- Source repository
- affaan-m/ECC
- Source file
- docs/ja-JP/skills/jpa-patterns/SKILL.md
- Fixed revision
- d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
Sources and evidence
This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.
Author: affaan-m/ECC · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-09T14:01:49.368Z.
Categories are inferred from names, descriptions and paths. They do not establish compatibility.
License and attribution
MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.
Original license ↗Synchronization, copying and user-reported success do not mark a resource as runtime-tested.
Limitations and notes
- Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.