Cuándo Activar
Diseñar entidades JPA y mapeos de tablas
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.
npx skills add https://github.com/affaan-m/ECC --skill "docs/es/skills/jpa-patterns"Source checked Jul 28, 2026·Refresh due Oct 26, 2026
Reorganized from the pinned upstream SKILL.md
Usar para modelado de datos, repositorios y ajuste de rendimiento en Spring Boot.
npx skills add https://github.com/affaan-m/ECC --skill "docs/es/skills/jpa-patterns"The pinned source contains enough sections and task detail for a source-grounded deep guide; automated content is still not an independent test.
565 source words · 11 usable sections
Documentation workflow
Sections are extracted automatically from the pinned SKILL.md and link back to the source.
Diseñar entidades JPA y mapeos de tablas
Review the “Diseño de Entidades” section in the pinned source before continuing.
Usar lazy loading por defecto; usar JOIN FETCH en consultas cuando sea necesario
Usar proyecciones para consultas ligeras:
Anotar métodos de servicio con @Transactional
SkillSignal prompt templates
These prompts were written by SkillSignal from the source structure; they are not upstream text.
Source-grounded prompt
Use for a documentation task while explicitly checking the source sections.
Use jpa-patterns for this documentation task: [task]. Inputs and constraints: [details]. Work through these pinned SKILL.md sections: “Cuándo Activar”, “Diseño de Entidades”, “Relaciones y Prevención de N+1”, “Patrones de Repositorio”, “Transacciones”. Cite the concrete requirements that shape each step, do not invent capabilities absent from the source, and verify the result against: [acceptance criteria].
Documentation checklist
The source section “Cuándo Activar” has been checked.
The source section “Diseño de Entidades” has been checked.
The source section “Relaciones y Prevención de N+1” has been checked.
The source section “Patrones de Repositorio” has been checked.
Choose a different workflow
JPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.
A separate implementation from affaan-m/ECC; compare its source, maintenance signals, and permission requirements.
Open source detailJPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.
A separate implementation from affaan-m/ECC; compare its source, maintenance signals, and permission requirements.
Open source detailSpring Boot'ta entity tasarımı, ilişkiler, sorgu optimizasyonu, transaction'lar, auditing, indeksleme, sayfalama ve pooling için JPA/Hibernate kalıpları.
A separate implementation from affaan-m/ECC; compare its source, maintenance signals, and permission requirements.
Open source detailFAQ
Usar para modelado de datos, repositorios y ajuste de rendimiento en Spring Boot.
The source record exposes this install command: npx skills add https://github.com/affaan-m/ECC --skill "docs/es/skills/jpa-patterns". Inspect the command and pinned source before running it.
Quality breakdown
Based on traceable docs and repository signals; stars are not treated as quality.
Compare before choosing
These links are selected from shared tasks, functions, stacks, platforms, and same-name variants. Compare the source owner, documentation, permissions, and maintenance signals.
JPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.
JPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.
Spring Boot'ta entity tasarımı, ilişkiler, sorgu optimizasyonu, transaction'lar, auditing, indeksleme, sayfalama ve pooling için JPA/Hibernate kalıpları.
JPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.
Review jpa-patterns's use cases, installation, workflow, and original source instructions.
Usar para modelado de datos, repositorios y ajuste de rendimiento en Spring Boot.
@Entity
@Table(name = "markets", indexes = {
@Index(name = "idx_markets_slug", columnList = "slug", unique = true)
})
@EntityListeners(AuditingEntityListener.class)
public class MarketEntity {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, length = 200)
private String name;
@Column(nullable = false, unique = true, length = 120)
private String slug;
@Enumerated(EnumType.STRING)
private MarketStatus status = MarketStatus.ACTIVE;
@CreatedDate private Instant createdAt;
@LastModifiedDate private Instant updatedAt;
}
Habilitar auditoría:
@Configuration
@EnableJpaAuditing
class JpaConfig {}
@OneToMany(mappedBy = "market", cascade = CascadeType.ALL, orphanRemoval = true)
private List<PositionEntity> positions = new ArrayList<>();
JOIN FETCH en consultas cuando sea necesarioEAGER en colecciones; usar proyecciones DTO para rutas de lectura@Query("select m from MarketEntity m left join fetch m.positions where m.id = :id")
Optional<MarketEntity> findWithPositions(@Param("id") Long id);
public interface MarketRepository extends JpaRepository<MarketEntity, Long> {
Optional<MarketEntity> findBySlug(String slug);
@Query("select m from MarketEntity m where m.status = :status")
Page<MarketEntity> findByStatus(@Param("status") MarketStatus status, Pageable pageable);
}
public interface MarketSummary {
Long getId();
String getName();
MarketStatus getStatus();
}
Page<MarketSummary> findAllBy(Pageable pageable);
@Transactional@Transactional(readOnly = true) para rutas de lectura y optimizar@Transactional
public Market updateStatus(Long id, MarketStatus status) {
MarketEntity entity = repo.findById(id)
.orElseThrow(() -> new EntityNotFoundException("Market"));
entity.setStatus(status);
return Market.from(entity);
}
PageRequest page = PageRequest.of(pageNumber, pageSize, Sort.by("createdAt").descending());
Page<MarketEntity> markets = repo.findByStatus(MarketStatus.ACTIVE, page);
Para paginación tipo cursor, incluir id > :lastId en JPQL con ordenamiento.
status, slug, claves foráneas)status, created_at)select *; proyectar solo las columnas necesariassaveAll y hibernate.jdbc.batch_sizePropiedades recomendadas:
spring.datasource.hikari.maximum-pool-size=20
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.validation-timeout=5000
Para el manejo de LOB en PostgreSQL, agregar:
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
@DataJpaTest con Testcontainers para replicar producciónlogging.level.org.hibernate.SQL=DEBUG y logging.level.org.hibernate.orm.jdbc.bind=TRACE para valores de parámetrosRecuerda: Mantener las entidades ligeras, las consultas intencionales y las transacciones cortas. Prevenir N+1 con estrategias de fetch y proyecciones, e indexar para tus rutas de lectura/escritura.