Implements Spring Data JPA persistence layers with repositories, entity relationships, derived/@Query methods, pagination, auditing, transactions, UUID keys, multi-DB setups, and indexing.
From developer-kit-javanpx claudepluginhub giuseppe-trisciuoglio/developer-kit --plugin developer-kit-javaThis skill is limited to using the following tools:
references/examples.mdreferences/reference.mdSearches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Enables AI agents to execute x402 payments with per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents pay for APIs, services, or other agents.
Provides patterns for Spring Data JPA repositories, entity relationships, queries, pagination, auditing, and transactions.
Creating repositories with CRUD operations, entity relationships, @Query annotations, pagination, auditing, or UUID primary keys.
To implement a repository interface:
Extend the appropriate repository interface:
@Repository
public interface UserRepository extends JpaRepository<User, Long> {
// Custom methods defined here
}
Use derived queries for simple conditions:
Optional<User> findByEmail(String email);
List<User> findByStatusOrderByCreatedDateDesc(String status);
Implement custom queries with @Query:
@Query("SELECT u FROM User u WHERE u.status = :status")
List<User> findActiveUsers(@Param("status") String status);
Define entities with proper annotations:
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, length = 100)
private String email;
}
Configure relationships using appropriate cascade types:
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Order> orders = new ArrayList<>();
Validation: Test cascade behavior with a small dataset before applying to production data. Verify delete operations don't cascade unexpectedly.
Set up database auditing:
@CreatedDate
@Column(nullable = false, updatable = false)
private LocalDateTime createdDate;
@Query for complex queries@Modifying for update/delete operations@Transactional(readOnly = true)1. Verify entity configuration:
2. Optimize query performance:
EXPLAIN ANALYZE on queries against large tables@EntityGraph to prevent N+1 queries3. Validate pagination:
@Repository
public interface ProductRepository extends JpaRepository<Product, Long> {
// Derived query
List<Product> findByCategory(String category);
// Custom query
@Query("SELECT p FROM Product p WHERE p.price > :minPrice")
List<Product> findExpensiveProducts(@Param("minPrice") BigDecimal minPrice);
}
@Service
public class ProductService {
private final ProductRepository repository;
public Page<Product> getProducts(int page, int size) {
Pageable pageable = PageRequest.of(page, size, Sort.by("name").ascending());
return repository.findAll(pageable);
}
}
@Entity
@EntityListeners(AuditingEntityListener.class)
public class Order {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@CreatedDate
@Column(nullable = false, updatable = false)
private LocalDateTime createdDate;
@LastModifiedDate
private LocalDateTime lastModifiedDate;
@CreatedBy
@Column(nullable = false, updatable = false)
private String createdBy;
}
final modifiers@Value for DTOs@Id and @GeneratedValue annotations@Table and @Column annotations@EntityGraph to avoid N+1 query problemsFor comprehensive examples, detailed patterns, and advanced configurations, see:
@EntityGraph or JOIN FETCH in queries.CascadeType.REMOVE on large collections as it can cause performance issues.EAGER fetch type for collections; it can cause excessive database queries.@Transactional(readOnly = true) for read operations to enable optimizations.