Prompt Details
Model
(claude-4-6-sonnet)
Token size
2,226
Example input
[PROJECT_TYPE]: Product catalog REST API
[VERSIONS]: Spring Boot 3.4, Hibernate 6.5, PostgreSQL 16
[LEVEL]: Mid-level Java developer, comfortable with Spring Boot
[GREENFIELD | STAGING | PRODUCTION]: PRODUCTION
[INPUT]: @Repositorypublic interface ProductRepository extends JpaRepository<Product, Long> { Optional<Product> findBySku(String sku);}@Entitypublic class Product { @Id @GeneratedValue Long id; @Column(unique = true) String sku; String name; BigDecimal price;}
Example output
## Verdict
SHIP — no N+1 risks; this is a clean primary-key-equivalent lookup on an unassociated entity.
## Top N+1 Risks
None detected. `Product` has no associations and `findBySku` resolves to a single indexed query (assuming the unique constraint on `sku` materialized as an index — verify with `\d product` or `SHOW INDEX`).
## Phase 2 Improvements
- Confirm that the `@Column(unique = true)` translated to a real database-side index. In some Hibernate configurations the unique constraint is enforced via a separate `CREATE UNIQUE INDEX` migration.
- If `Product` gains associations (e.g. `@OneToMany List<ProductVariant>`), revisit this audit.
By purchasing this prompt, you agree to our terms of service
CLAUDE-4-6-SONNET
Catches JPA N+1 query bugs before your DBA does. Paste a Spring Boot repository, the entities, and the calling service — get a ranked list of N+1 risks with the exact failing lines, query-count math (e.g. "for 100 orders, 201 queries"), and corrected snippets using JOIN FETCH, @EntityGraph, or @BatchSize. Outputs a SHIP/BLOCK/REFACTOR verdict pasteable into PR descriptions. Built for Claude using XML-tag prompting. Spring Boot 3.x + Hibernate 6.x.
...more
Added 4 days ago
