Version: 3.0.16 | Java: 17+ | Spring Boot: 3.x
A multi-module framework that eliminates JPA boilerplate through compile-time code generation and runtime dynamic query building.
| Module | Description |
|---|---|
| common-jpa-service | Core runtime engine: dynamic JPQL/SQL query execution, reflection-based filter binding, service abstractions |
| processor-jpa-service | Compile-time annotation processor that generates QueryJpqlImpl classes from @QueryBuilder |
| proxy-api-controller | Dynamic REST controller framework: generate API endpoints with annotations, no controller code required |
| jpa-service-plugin-generator | Maven plugin that scaffolds service, service-impl, and repository classes from JPA entities |
| project-jpa-persistence | Example Spring Boot application demonstrating the full framework |
┌──────────────────────────────────────────────────────────┐
│ Your Spring Boot App │
│ │
│ ┌───────────────────┐ ┌──────────────────────────┐ │
│ │ REST Controllers │ │ proxy-api-controller │ │
│ │ (manual) │ │ (@ApiFindController) │ │
│ └────────┬──────────┘ └────────────┬─────────────┘ │
│ │ │ │
│ └─────────────┬─────────────┘ │
│ ▼ │
│ ┌─────────────────────┐ │
│ │ JpaService<T, ID> │ ← common-jpa-service│
│ │ (JpaServiceImpl) │ │
│ └─────────┬───────────┘ │
│ │ │
│ ┌───────────────┴───────────────┐ │
│ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────────┐ │
│ │ JpaRepository│ │ QueryJpqlImpl │ │
│ │ (Spring Data)│ │ (generated by │ │
│ └──────────────┘ │ processor) │ │
│ └──────────────────┘ │
└──────────────────────────────────────────────────────────┘
Compile time:
processor-jpa-service → generates QueryJpqlImpl
jpa-service-plugin-generator → scaffolds Service/Repository classes
Compile time
jpa-service-plugin-generator(Maven plugin,generate-sourcesphase) scans the configured entity package and generates*Service,*ServiceImpl, and*Repositoryclass skeletons.processor-jpa-service(annotation processor) reads every@QueryBuilder-annotated service interface and generates the corresponding*QueryJpqlImplclass containing pre-built JPQL strings and condition maps.
Runtime
- Spring autowires the generated services and repositories.
- A
@ApiFindControllerinterface is registered as a Spring@RestControllervia a Java dynamic proxy. - Each HTTP request is handled by
FindInterceptor, which builds aQueryParameterfrom the request, resolves the correctJpaService, and executes the query. JpaServiceImpldelegates query execution toBaseJpaService, which assembles the WHERE clause, JOIN FETCH clauses, ORDER BY, and pagination dynamically.- Results are mapped to DTOs via
@ApiMapperand returned.
Add the three runtime dependencies and the annotation processor to your project:
<dependencies>
<dependency>
<groupId>com.bld.commons</groupId>
<artifactId>common-jpa-service</artifactId>
<version>3.0.16</version>
</dependency>
<dependency>
<groupId>com.bld.commons</groupId>
<artifactId>proxy-api-controller</artifactId>
<version>3.0.16</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Scaffold generator (run once to create service/repository skeletons) -->
<plugin>
<groupId>com.bld.commons</groupId>
<artifactId>jpa-service-plugin-generator</artifactId>
<version>3.0.16</version>
<configuration>
<persistencePackage>com.example.domain</persistencePackage>
<servicePackage>com.example.service</servicePackage>
<basePackage>com.example</basePackage>
</configuration>
</plugin>
<!-- Annotation processor (generates QueryJpqlImpl at compile time) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>com.bld.commons</groupId>
<artifactId>processor-jpa-service</artifactId>
<version>3.0.16</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>See project-jpa-persistence for a complete working example.
Detailed documentation for each module is in its own README (links in the table above). The docs/ directory contains an extended reference covering the complete API.