AgentStack
SKILL verified MIT Self-run

Hibernate Orm Persistence

skill-vaquarkhan-fullstack-development-agent-skills-hibernate-orm-persistence · by vaquarkhan

Model and query relational data with Hibernate ORM — entities, associations, fetch plans, caching, and HQL/Criteria. Use for Java persistence beyond basic Spring Data JPA defaults or in Jakarta EE applications.

No reviews yet
0 installs
13 views
0.0% view→install

Install

$ agentstack add skill-vaquarkhan-fullstack-development-agent-skills-hibernate-orm-persistence

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Hibernate Orm Persistence? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Hibernate ORM Persistence

Use When

  • Complex entity graphs, inheritance, or custom SQL require full Hibernate control
  • N+1 queries, fetch joins, or second-level cache tuning are needed
  • Working with Hibernate directly (Jakarta EE) or via Spring Data JPA with native Hibernate features

Workflow

  1. Model entities with clear aggregate roots; prefer FetchType.LAZY associations.
  2. Define equals/hashCode on business keys — not database IDs for transient entities.
  3. Use @NamedQuery, JPQL, or Criteria API; native SQL only when justified.
  4. Tune fetch plans: @EntityGraph, join fetch, or DTO projections for read paths.
  5. Enable query logging in dev; verify query count in tests for list endpoints.

Required Checks

  • No EAGER collections on high-cardinality associations without explicit justification
  • @Version optimistic locking on concurrent update entities
  • Batch size (@BatchSize or hibernate.default_batch_fetch_size) for collection fetching
  • Second-level cache only with explicit invalidation strategy

Examples And Templates

See examples/ for side-by-side good vs bad patterns agents commonly get wrong. See templates/ for copy-paste starters aligned with this skill.

Decision Framework

  • Prefer Spring Data repositories for simple CRUD; drop to Hibernate API for complex queries.
  • Use @SqlResultSetMapping or Blaze Persistence for heavy reporting queries.
  • Prefer merge vs persist semantics consciously in service layer.
  • Schema changes via Flyway/Liquibase — Hibernate ddl-auto=validate in production.

Common Rationalizations And Rebuttals

  • "EAGER loading prevents LazyInitializationException." -> Fix session boundaries and fetch plans; EAGER causes cartesian product queries.
  • "Hibernate generates schema in prod." -> Use migrations; ddl-auto validate only.
  • "Lombok @Data on entities is fine." -> Breaks entity equality and can trigger unnecessary updates.

Evidence Pack

  • Entity relationship diagram with fetch types annotated
  • Query count assertion for critical list/read endpoints
  • Migration scripts aligned with entity model
  • N+1 fix evidence (before/after query logs)

Exit Criteria

  • Entity model matches domain boundaries without session leaks
  • List and detail queries meet performance budgets
  • Production uses validated schema, not auto-ddl

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.