Agent skill

Hibernate Upgrade

by benchflow-ai in benchflow-ai/skillsbench

Migrate Hibernate 5 to Hibernate 6 with Spring Boot 3. An agent skill from benchflow-ai/skillsbench.

Apache-2.0Auto-check passedDatabases

Install Hibernate Upgrade

skills CLI
$ npx skills add benchflow-ai/skillsbench --skill hibernate-upgrade -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install benchflow-ai/skillsbench hibernate-upgrade --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/benchflow-ai/skillsbench.git skills-src && mkdir -p .claude/skills && cp -r skills-src/tasks/spring-boot-jakarta-migration/environment/skills/hibernate-upgrade .claude/skills/hibernate-upgrade && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
hibernate-upgrade
GitHub stars
1.8k
Token cost
~1.9k tokens
SKILL.md length
295 words
Files
1
Skills in repo
189
Repo updated
First seen
Licence
Apache-2.0

At a glance

Migrate Hibernate 5 to Hibernate 6 with Spring Boot 3. An agent skill from benchflow-ai/skillsbench.

  • Works in 10 steps: Package Namespace → ID Generation Strategies → Dialect Configuration → …
  • Fixing HQL/JPQL query parsing issues
  • SKILL.md covers Overview, Key Changes, Deprecation Removals and Configuration Properties, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Hibernate Upgrade is an agent skill from benchflow-ai/skillsbench. Migrate Hibernate 5 to Hibernate 6 with Spring Boot 3. Use when fixing HQL/JPQL query parsing issues, removing deprecated Criteria API, updating ID generation strategies, or diagnosing N+1 query behavior changes. Covers breaking changes, type mappings, and performance monitoring.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases, covering ORMs and data access and Backend development. It works with Spring Boot. The repository describes itself as: SkillsBench evaluates how well skills work and how effective agents are at using them. The licence is Apache-2.0.

When your agent uses it

  • Fixing HQL/JPQL query parsing issues
  • Removing deprecated Criteria API
  • Updating ID generation strategies
  • Diagnosing N+1 query behavior changes

Example prompts

  • “/hibernate-upgrade”

Workflow steps

10 steps, taken from the step headings in SKILL.md.

  1. Package Namespace
  2. ID Generation Strategies
  3. Dialect Configuration
  4. Query Changes
  5. Type Mappings
  6. Fetch Strategies
  7. HQL/JPQL Query Parsing is Stricter
  8. Distinct is No Longer Needed for Collections
  9. Legacy Criteria API Removed
  10. N+1 Query Behavior Changes

What it can do on your machine

Read from SKILL.md and the folder at commit 9a1f4dd. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are java, properties and bash).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • docs.jboss.org
    • thorben-janssen.com
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Hibernate Upgrade loads about 1.9k tokens when it runs. Until then it costs about 75 tokens; SKILL.md has 295 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~75
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from benchflow-ai/skillsbench at commit 9a1f4dd, republished under its Apache-2.0 licence (© benchflow-ai). 295 words, ~1,877 tokens.

Download SKILL.mdSave it as .claude/skills/hibernate-upgrade/SKILL.md (or your agent's skills folder).
name
hibernate-upgrade
description
Migrate Hibernate 5 to Hibernate 6 with Spring Boot 3. Use when fixing HQL/JPQL query parsing issues, removing deprecated Criteria API, updating ID generation strategies, or diagnosing N+1 query behavior changes. Covers breaking changes, type mappings, and performance monitoring.

Hibernate 5 to 6 Upgrade Skill

Overview

Spring Boot 3 uses Hibernate 6, which includes significant changes from Hibernate 5. This skill covers the key migration considerations.

Key Changes

1. Package Namespace

Hibernate 6 uses Jakarta Persistence:

java
// Before (Hibernate 5)
import javax.persistence.*;
import org.hibernate.annotations.*;

// After (Hibernate 6)
import jakarta.persistence.*;
import org.hibernate.annotations.*;
2. ID Generation Strategies

Hibernate 6 changed the default ID generation strategy:

java
// Recommended approach for cross-database compatibility
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

// Or using sequences (preferred for some databases)
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "user_seq")
@SequenceGenerator(name = "user_seq", sequenceName = "user_sequence", allocationSize = 1)
private Long id;
3. Dialect Configuration

Hibernate 6 can auto-detect dialects in most cases:

properties
# Before (often required in Hibernate 5)
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

# After (Hibernate 6) - often can be removed
# Hibernate auto-detects based on JDBC URL
# Only specify if you need specific behavior

If you must specify:

properties
# Hibernate 6 dialects (some renamed)
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
4. Query Changes
JPQL Changes

Some JPQL syntax has stricter validation:

java
// Be explicit about entity aliases
@Query("SELECT u FROM User u WHERE u.active = true")
List<User> findActiveUsers();

// Avoid implicit joins - be explicit
@Query("SELECT u FROM User u JOIN u.roles r WHERE r.name = :roleName")
List<User> findByRoleName(@Param("roleName") String roleName);
Native Queries

Native query result mapping changed:

java
// Before (Hibernate 5)
@Query(value = "SELECT * FROM users WHERE active = 1", nativeQuery = true)
List<User> findActiveUsersNative();

// After (Hibernate 6) - works the same, but be careful with projections
@Query(value = "SELECT * FROM users WHERE active = true", nativeQuery = true)
List<User> findActiveUsersNative();
5. Type Mappings

Some type mappings changed:

java
// Enum mapping - explicit is better
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private Role role;

// Date/Time - use java.time classes
@Column(name = "created_at")
private LocalDateTime createdAt;  // Preferred over java.util.Date
6. Fetch Strategies

Default fetch behavior remains similar, but be explicit:

java
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "department_id")
private Department department;

@OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
private List<Order> orders;

Deprecation Removals

Removed in Hibernate 6
  1. @Type annotation - replaced with @JdbcTypeCode or custom type definitions
  2. Legacy ID generators - use standard JPA generation
  3. @TypeDef - removed, use @Type with explicit class
Example Migration
java
// Before (Hibernate 5 with custom type)
@TypeDef(name = "json", typeClass = JsonType.class)
@Type(type = "json")
private JsonNode metadata;

// After (Hibernate 6)
@JdbcTypeCode(SqlTypes.JSON)
private JsonNode metadata;

Configuration Properties

Some Hibernate properties changed:

properties
# Common properties that remain the same
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.show-sql=true

# Properties that may need review
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.use_sql_comments=true

# New in Hibernate 6
spring.jpa.properties.hibernate.timezone.default_storage=NORMALIZE

Testing Considerations

  1. Entity validation - Hibernate 6 is stricter about entity mappings
  2. Query parsing - Some queries that worked in H5 may fail in H6
  3. Performance - Test performance as query execution plans may differ

Troubleshooting

Common Errors
  1. "Unknown entity" - Ensure entity scanning is configured correctly
  2. "Could not determine type" - Check type mappings and annotations
  3. "Query syntax error" - Review JPQL for stricter H6 parsing rules

Critical Breaking Changes

1. HQL/JPQL Query Parsing is Stricter
java
// BEFORE (Hibernate 5) - this worked but was non-standard
@Query("update from User u set u.active = false where u.id = :id")

// AFTER (Hibernate 6) - remove the optional "from" keyword
@Query("update User u set u.active = false where u.id = :id")
2. Distinct is No Longer Needed for Collections
java
// BEFORE (Hibernate 5) - needed distinct to avoid duplicates
@Query("select distinct u from User u join fetch u.roles")

// AFTER (Hibernate 6) - duplicates are automatically filtered
@Query("select u from User u join fetch u.roles")
3. Legacy Criteria API Removed

The deprecated org.hibernate.Criteria API is completely removed. You must use JPA Criteria API:

java
// BEFORE (Hibernate 5 - old Criteria)
Criteria criteria = session.createCriteria(User.class);
criteria.add(Restrictions.eq("active", true));
List<User> users = criteria.list();

// AFTER (Hibernate 6 - JPA Criteria)
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<User> cq = cb.createQuery(User.class);
Root<User> root = cq.from(User.class);
cq.where(cb.equal(root.get("active"), true));
List<User> users = entityManager.createQuery(cq).getResultList();
4. N+1 Query Behavior Changes

Hibernate 6 may generate different SQL for lazy-loaded collections. Monitor your queries:

java
// Add this to application.properties to monitor queries
spring.jpa.properties.hibernate.generate_statistics=true
logging.level.org.hibernate.stat=debug
logging.level.org.hibernate.SQL=debug

Migration Commands

Check for Hibernate 5 Patterns
bash
# Check for old Criteria API usage
grep -r "session.createCriteria\|org.hibernate.Criteria" --include="*.java" .

# Check for deprecated @Type usage
grep -r "@Type(type\s*=" --include="*.java" .

# Check for @TypeDef
grep -r "@TypeDef" --include="*.java" .

# Check for "update from" pattern in queries
grep -r "update from" --include="*.java" .
Fix Common Issues
bash
# Remove "from" keyword in update queries
find . -name "*.java" -type f -exec sed -i 's/update from /update /g' {} +

Performance Monitoring

After migration, monitor for performance regressions:

properties
# Enable Hibernate statistics
spring.jpa.properties.hibernate.generate_statistics=true

# Log slow queries (Hibernate 6.2+)
spring.jpa.properties.hibernate.session.events.log.LOG_QUERIES_SLOWER_THAN_MS=100

Sources

© benchflow-ai, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in tasks/spring-boot-jakarta-migration/environment/skills/hibernate-upgrade of benchflow-ai/skillsbench.

Open the folder on GitHubat commit 9a1f4dd

Compare with similar skills

Hibernate Upgrade next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Hibernate Upgrade compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Hibernate Upgrade this skillbenchflow-ai/skillsbench1.8k—~1.9kAutomated safety check: PassApache-2.0
Jpa Patternsaffaan-m/ECC276k1 repos~1.2kAutomated safety check: PassMIT
Jpa Patternsaffaan-m/ECC276k—~1.2kAutomated safety check: PassMIT
Jpa Patternsxu-xiang/everything-claude-code-zh2k—~896Automated safety check: PassMIT
Jpa Patternsaffaan-m/ECC276k5 repos~1.2kAutomated safety check: PassMIT
Jpa Patternsaffaan-m/ECC276k3 repos~847Automated safety check: PassMIT

Similar skills

  • Jpa Patterns

    affaan-m/ECC

    Spring Boot'ta entity tasarımı, ilişkiler, sorgu optimizasyonu, transaction'lar, auditing, indeksleme, sayfalama ve pooling için JPA/Hibernate kalıpları.

    276k GitHub starsUsed in 1 repo~1.2k tokens
    DatabasesAuto-check passed
  • Jpa Patterns

    affaan-m/ECC

    Patrones JPA/Hibernate para diseño de entidades, relaciones, optimización de consultas, transacciones, auditoría, indexación, paginación y pooling en Spring Boot.

    276k GitHub stars~1.2k tokensUpdated today
    DatabasesAuto-check passed
  • Jpa Patterns

    xu-xiang/everything-claude-code-zh

    Spring Boot 中用于实体设计、关联关系、查询优化、事务、审计、索引、分页和连接池的 JPA/Hibernate 模式。

    2k GitHub stars~896 tokensUpdated 7 mo ago
    DatabasesAuto-check passed
  • Jpa Patterns

    affaan-m/ECC

    JPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.

    276k GitHub starsUsed in 5 repos~1.2k tokens
    DatabasesAuto-check passed
  • Jpa Patterns

    affaan-m/ECC

    Spring Boot中的JPA/Hibernate模式,用于实体设计、关系处理、查询优化、事务管理、审计、索引、分页和连接池。

    276k GitHub starsUsed in 3 repos~847 tokens
    Backend & APIsAuto-check passed
  • Java Patterns

    softspark/ai-toolkit

    Java: Spring Boot, CompletableFuture, records, sealed types, JPA/Hibernate, virtual threads.

    179 GitHub stars~3.4k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed

More from benchflow-ai/skillsbench

All 189 skills in this repo
  • Lean4 Memories

    benchflow-ai/skillsbench

    This skill should be used when working on Lean 4 formalization projects to maintain persistent memory of successful proof patterns, failed approaches, project conventions, and user preferences…

    1.8k GitHub stars~3.2k tokensUpdated 2 mo ago
    Auto-check passed
  • Senior Data Engineer

    benchflow-ai/skillsbench

    World-class data engineering skill for building scalable data pipelines, ETL/ELT systems, real-time streaming, and data infrastructure.

    1.8k GitHub stars~5.9k tokensUpdated 2 mo ago
    Auto-check passed
  • Ac Branch Pi Model

    benchflow-ai/skillsbench

    AC branch pi-model power flow equations (P/Q and |S|) with transformer tap ratio and phase shift, matching acopf-math-model.md and MATPOWER branch fields.

    1.8k GitHub stars~1.1k tokensUpdated 2 mo ago
    Auto-check passed
  • Civ6lib

    benchflow-ai/skillsbench

    Civilization 6 district mechanics library. An agent skill from benchflow-ai/skillsbench.

    1.8k GitHub stars~1.7k tokensUpdated 2 mo ago
    Auto-check passed
  • D3 Visualization

    benchflow-ai/skillsbench

    Build deterministic, verifiable data visualizations with D3.js (v6).

    1.8k GitHub stars~1.5k tokensUpdated 2 mo ago
    Auto-check passed
  • Dc Power Flow

    benchflow-ai/skillsbench

    DC power flow analysis for power systems. An agent skill from benchflow-ai/skillsbench.

    1.8k GitHub stars~717 tokensUpdated 2 mo ago
    Auto-check passed

Works with

Questions about Hibernate Upgrade

What does Hibernate Upgrade do?

Migrate Hibernate 5 to Hibernate 6 with Spring Boot 3. An agent skill from benchflow-ai/skillsbench. Hibernate Upgrade is an agent skill from benchflow-ai/skillsbench. Migrate Hibernate 5 to Hibernate 6 with Spring Boot 3.

When should I use Hibernate Upgrade?

Hibernate Upgrade fits situations like: fixing HQL/JPQL query parsing issues; removing deprecated Criteria API; updating ID generation strategies; diagnosing N+1 query behavior changes.

How do I install Hibernate Upgrade in Claude Code?

Run `npx skills add benchflow-ai/skillsbench --skill hibernate-upgrade -a claude-code`. Or copy the skill folder (tasks/spring-boot-jakarta-migration/environment/skills/hibernate-upgrade in benchflow-ai/skillsbench) into .claude/skills/hibernate-upgrade in your project. Claude Code loads it when a task matches its description.

How do I install Hibernate Upgrade in Codex?

Run `npx skills add benchflow-ai/skillsbench --skill hibernate-upgrade -a codex`. Or copy the skill folder (tasks/spring-boot-jakarta-migration/environment/skills/hibernate-upgrade in benchflow-ai/skillsbench) into .agents/skills/hibernate-upgrade in your project. Codex loads it when a task matches its description.

Can I use Hibernate Upgrade in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add benchflow-ai/skillsbench --skill hibernate-upgrade -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/hibernate-upgrade, .gemini/skills/hibernate-upgrade, .github/skills/hibernate-upgrade and .opencode/skills/hibernate-upgrade in your project.

What does Hibernate Upgrade need to run?

SKILL.md names no scripts, command-line tools or credentials: Hibernate Upgrade is instructions for the agent only.

Does Hibernate Upgrade access the network?

SKILL.md names 3 domains. As links in the text: docs.jboss.org, thorben-janssen.com and github.com. This is read from the text; nothing was executed.

Is Hibernate Upgrade safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Hibernate Upgrade use?

Hibernate Upgrade is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Hibernate Upgrade use?

About 1.9k tokens (SKILL.md is roughly 7.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Hibernate Upgrade?

Skills that share tags, products or a category with Hibernate Upgrade: Jpa Patterns (affaan-m/ECC, 276k stars), Jpa Patterns (affaan-m/ECC, 276k stars), Jpa Patterns (xu-xiang/everything-claude-code-zh, 2k stars) and Jpa Patterns (affaan-m/ECC, 276k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Hibernate Upgrade?

benchflow-ai (a GitHub organization) maintains it in benchflow-ai/skillsbench, which has 1,835 GitHub stars. The repository holds 189 skills in this directory. The repository was last updated on July 23, 2026.

Source: benchflow-ai/skillsbench on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.