ai-unified-process/aiup-jpa
AI Unified Process persistence layer with Spring Data JPA - entities, repositories, and repository tests
Implements the persistence layer of a use case (UC-XXX) with Spring Data JPA and Hibernate: @Entity classes mapped onto the Flyway schema (ddl-auto=validate, never create or update), Spring Data JpaRepository interfaces, derived and @Query queries, interface and record projections, attribute converters, fetch joins and entity graphs against N+1 selects, and @Version optimistic locking. Detects a flat single-module or a hexagonal multi-module backend; in the hexagonal case it writes the persistence adapter and the outbound port it implements. No Lombok. Use when the user asks to "write the JPA entities", "create the repository for UC-001", "implement the persistence layer", "map the table to an entity", "fix the N+1 query", or mentions Spring Data JPA, Hibernate, @Entity, JpaRepository, or a persistence adapter. Normally run by /use-case-implement as the Persistence layer; it can also be run directly.
Writes the persistence tests of a use case (UC-XXX) for Spring Data JPA: @DataJpaTest classes against a real database in a Testcontainers container (never H2 unless the project already tests on it), test data from Flyway test migrations, one UC<id><Name>RepositoryTest class per use case with @UseCase annotations. Tests only queries with logic of their own — filters, joins, projections, paging, fetch joins, custom @Query and Specification queries, attribute converters — and says so when the use case has none. In a hexagonal backend it tests through the persistence adapter in the adapter module. Use when the user asks to "test the repository", "write a @DataJpaTest", "test the JPA query of UC-001", "write persistence tests", or mentions DataJpaTest, repository tests, or Testcontainers for Spring Data JPA. /use-case-test runs it only to reconcile existing tests, for queries the integration layer cannot reach, or when the persistence layer is named; it can also be run directly.