hack23/cia/jpa-hibernate-optimization

Claude Code and agent skill by hack23/cia

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Optimize JPA/Hibernate: entity design, query performance, N+1 prevention, caching strategies

Install

npx vskill@latest install hack23/cia/jpa-hibernate-optimization

SKILL.md

The same SKILL.md was published earlier as hack23/cia/jpa-hibernate-optimization.

JPA/Hibernate Optimization Skill

Purpose

Optimize database access with proper entity design, query optimization, and caching.

When to Use

  • ✅ Designing entity relationships
  • ✅ Optimizing slow queries
  • ✅ Preventing N+1 queries
  • ✅ Implementing caching

Entity Optimization

java
@Entity
@Table(name = "politician", indexes = {
@Index(name = "idx_politician_party", columnList = "party"),
@Index(name = "idx_politician_district", columnList = "district")
})
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Politician {
@Id
private String id;
@Column(name = "first_name", nullable = false, length = 50)
private String firstName;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "party_id")
private Party party;
@OneToMany(mappedBy = "politician", cascade = CascadeType.ALL, orphanRemoval = true)
@BatchSize(size = 20)
private List<VotingRecord> votingRecords;
}

Query Optimization

java
// Use JOIN FETCH to prevent N+1
@Query("SELECT p FROM Politician p JOIN FETCH p.party WHERE p.district = :district")
List<Politician> findByDistrictWithParty(@Param("district") String district);
// Use DTOs for read-only queries
@Query("SELECT new com.hack23.cia.dto.PoliticianSummary(p.id, p.firstName, p.lastName) " +
"FROM Politician p WHERE p.active = true")
List<PoliticianSummary> findActivePoliticiansSummary();
// Pagination for large result sets
Page<Politician> findByParty(String party, Pageable pageable);

Second-Level Cache

yaml
spring:
jpa:
properties:
hibernate:
cache:
use_second_level_cache: true
region:
factory_class: org.hibernate.cache.jcache.JCacheRegionFactory
javax:
cache:
provider: org.ehcache.jsr107.EhcacheCachingProvider

References

  • Hibernate: https://hibernate.org/
  • DATA_MODEL.md

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
235
Repository forks
56
7-day trend score
27

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/hack23/cia/jpa-hibernate-optimization/badge)](https://verified-skill.com/skills/hack23/cia/jpa-hibernate-optimization)

Something wrong with this skill or its page? Tell us.