Skip to content

Commit b7ee81e

Browse files
committed
Adding basic CLAUDE.md
We will edit it as needed
1 parent 7ca8ee8 commit b7ee81e

1 file changed

Lines changed: 98 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Apache Cayenne is a Java ORM and persistence framework. This is a multi-module Maven project (22 modules) targeting Java 11+.
8+
9+
## Build Commands
10+
11+
```bash
12+
# Full build
13+
mvn clean verify
14+
15+
# Skip tests
16+
mvn clean verify -DskipTests
17+
18+
# Build a single module and its dependencies
19+
mvn clean verify -pl cayenne -am
20+
```
21+
22+
## Testing
23+
24+
The `cayenneTestConnection` property selects the database backend for tests. Default is HSQL.
25+
26+
```bash
27+
# Run all tests (HSQL)
28+
mvn verify
29+
30+
# Run against specific databases
31+
mvn verify -DcayenneTestConnection=h2
32+
mvn verify -DcayenneTestConnection=derby
33+
mvn verify -DcayenneTestConnection=mysql-tc # via TestContainers
34+
mvn verify -DcayenneTestConnection=postgres-tc # via TestContainers
35+
mvn verify -DcayenneTestConnection=sqlserver-tc # via TestContainers
36+
37+
# Run a single test class (in the relevant module directory)
38+
mvn test -Dtest=PoolingDataSourceTest
39+
40+
# Run a single test method
41+
mvn test -Dtest=PoolingDataSourceTest#testConnection
42+
43+
# Run a single test against a specific database
44+
mvn test -Dtest=SomeTest -DcayenneTestConnection=h2
45+
```
46+
47+
CI runs JDK 11 and 17 with all database profiles on each PR.
48+
49+
## Module Structure
50+
51+
- **cayenne** — Core ORM library (main module to work with)
52+
- **cayenne-di** — Lightweight DI container used internally
53+
- **cayenne-project** — Cayenne project/model file management
54+
- **cayenne-cgen** — Code generation from database schemas
55+
- **cayenne-dbsync** — Database schema synchronization
56+
- **cayenne-gradle-plugin**, **maven-plugins**, **cayenne-ant** — Build tool integrations
57+
- **cayenne-crypto**, **cayenne-commitlog**, **cayenne-lifecycle**, **cayenne-jcache**, **cayenne-cache-invalidation** — Optional extension modules
58+
- **modeler** — CayenneModeler GUI application (Swing)
59+
60+
## Architecture
61+
62+
### Core Abstractions
63+
64+
- **`CayenneRuntime`** — Entry point; manages lifecycle and wires together all components via `cayenne-di`
65+
- **`ObjectContext`** — Primary user-facing API for CRUD operations; tracks object changes and commits transactions
66+
- **`DataChannel`** / **`DataDomain`** — Sits between `ObjectContext` and the database; routes queries and manages caching
67+
- **`DataNode`** — Represents a physical database connection (datasource + adapter)
68+
- **`DbAdapter`** — Database-specific SQL generation; implementations in `org.apache.cayenne.dba.*` (MySQL, PostgreSQL, Oracle, etc.)
69+
70+
### Query API
71+
72+
- **`ObjectSelect`** — Modern fluent API for fetching persistent objects (preferred)
73+
- **`SQLSelect`** / **`SQLExec`** — Raw SQL with Cayenne parameter binding
74+
- **`EJBQLQuery`** — Legacy EJBQL support
75+
- **`Expression`** / **`ExpressionFactory`** — In-memory and SQL predicate building
76+
77+
### ORM Mapping
78+
79+
- Mapping metadata lives in `cayenne-project.xml` (project descriptor) and `*.map.xml` files (per-DataMap); loaded at startup into `DataMap` / `EntityResolver`
80+
- `ObjEntity` → Java class; `DbEntity` → database table; `ObjRelationship` / `DbRelationship` → joins
81+
- Persistent classes extend `_Abstract*` superclasses generated by `cayenne-cgen`; user subclasses those
82+
83+
### Key Packages (inside `cayenne/src/main/java/org/apache/cayenne/`)
84+
85+
| Package | Purpose |
86+
|---|---|
87+
| `access/` | Database access layer, `DataDomain`, `DataContext` |
88+
| `configuration/` | Runtime bootstrap, XML config loading |
89+
| `query/` | All query types |
90+
| `exp/` | Expression/criteria parsing and evaluation |
91+
| `dba/` | Per-database SQL dialects and adapters |
92+
| `map/` | ORM mapping metadata (`DataMap`, `ObjEntity`, etc.) |
93+
| `runtime/` | `CayenneRuntime`, DI module wiring |
94+
| `tx/` | Transaction management |
95+
96+
### Test Infrastructure
97+
98+
Tests in `cayenne/src/test/` use a shared set of test mapping files and database scripts in `src/test/resources/`. The `DBHelper` and `UnitDbAdapter` utilities handle database-specific test setup. TestContainers is used for non-embedded databases.

0 commit comments

Comments
 (0)