CLAUDE.mdgo
querydsl CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Overview
This is Querydsl, a framework for constructing type-safe SQL-like queries for multiple backends including JPA, MongoDB, and SQL in Java. This is a fork under OpenFeign maintaining the project with regular releases since the original project became stale.
Build Commands
Basic Build
./mvnw clean install
Quick Build (skip tests and checks)
./mvnw -Pquickbuild clean install
Profile-specific builds
# Build specific modules (e.g., jpa, sql, mongodb, or all)
./mvnw -Pquickbuild,jpa clean install
./mvnw -Pquickbuild,sql clean install
./mvnw -Pquickbuild,all clean install
Test Commands
# Run tests without external databases
./mvnw -Pno-databases verify
# Run CI profile tests (excludes slow tests)
./mvnw -Pci verify
# Run development profile tests (excludes external databases and slow tests)
./mvnw -Pdev verify
# Run specific database tests
./mvnw -Pci -Dgroups=com.querydsl.core.testutil.MySQL verify
./mvnw -Pci -Dgroups=com.querydsl.core.testutil.PostgreSQL verify
Code Quality
# Format code
./mvnw -Pdev initialize
# Check code format
./mvnw git-code-format:validate-code-format
# Run coverage checks
./mvnw jacoco:report
Examples
# Build examples
./mvnw -Pexamples clean install
# Build specific example projects
cd querydsl-examples/querydsl-example-jpa-spring
./mvnw clean install
Project Architecture
Module Structure
-
querydsl-tooling/: Code generation and tooling modules
querydsl-apt/: Annotation processing toolsquerydsl-codegen/: Code generation utilitiesquerydsl-sql-codegen/: SQL schema-based code generationquerydsl-kotlin-codegen/: Kotlin code generationquerydsl-ksp-codegen/: Kotlin Symbol Processing supportquerydsl-maven-plugin/: Maven plugin for code generation
-
querydsl-libraries/: Core library modules
querydsl-core/: Core query DSL frameworkquerydsl-jpa/: JPA integration with Hibernate and EclipseLink supportquerydsl-sql/: SQL query support for various databasesquerydsl-mongodb/: MongoDB integrationquerydsl-collections/: In-memory collections queryingquerydsl-r2dbc/: R2DBC reactive database supportquerydsl-spatial/: Spatial/GIS query extensionsquerydsl-kotlin/: Kotlin language supportquerydsl-scala/: Scala language support
Key Technologies
- Java 17+: Main source code (tests use Java 21)
- Maven: Build system with multi-module structure
- Annotation Processing: Code generation via APT
- Database Support: PostgreSQL, MySQL, Oracle, SQL Server, H2, Derby, SQLite, Firebird, CUBRID, DB2
- JPA Providers: Hibernate, EclipseLink
- Testing: JUnit 5, AssertJ, database containers for integration tests
Code Generation Flow
- Entity classes are annotated with
@Entity(JPA) or@QueryEntity(general) - Annotation processors generate Q-classes (query types) at compile time
- Q-classes provide type-safe query construction via fluent API
- Queries are executed through backend-specific implementations
Database Testing Strategy
- Uses Docker Compose for integration testing with real databases
- CircleCI runs parallel test jobs for each database type
- Tests are categorized by database type using JUnit 5 tags
- Embedded databases (H2, Derby, SQLite) for quick testing
Development Profiles
- no-databases: Excludes all database-dependent tests
- ci: Excludes slow tests and performance tests (used in CI)
- dev: Excludes external database tests and slow tests (for local development)
- quickbuild: Skips tests, enforcer, and documentation generation
- examples: Includes example projects in build
- release: Adds source/javadoc jars and GPG signing
Common Tasks
Adding New Database Support
- Add database driver dependency to
querydsl-sql/pom.xml - Create database-specific template in
querydsl-sql/src/main/resources/ - Add keywords file in
querydsl-sql/src/main/resources/keywords/ - Update
SQLTemplatesfactory methods - Add CircleCI job for database testing
Code Generation
- APT processors are in
querydsl-apt/with separate service files for each backend - Kotlin code generation uses KSP (Kotlin Symbol Processing)
- SQL codegen reads database metadata to generate Q-classes
- Maven plugin provides
querydsl:exportgoal for SQL codegen
Testing Guidelines
- Use
@Tagannotations to categorize tests by database or performance characteristics - Integration tests should extend appropriate base classes from
querydsl-core/src/test/java/com/querydsl/ - Database-specific tests go in modules like
querydsl-jpa/src/test/java/com/querydsl/jpa/