/apache-cayenne-6:cayenne-upgradefrom apache-cayenne-6
Upgrades Apache Cayenne projects to the current format using the upgrade_project MCP tool, then updates application code to match. Handles destructive changes like removed DataNodes, EJBQL queries, and entity callbacks.
Ships in apache-cayenne-6. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Upgrade a Cayenne project to the current format with the upgrade_project MCP tool, and bring the
application code in line with it.
An upgrade can be destructive: some parts of an old project have no equivalent in the current format, and the
upgrade removes or alters them (e.g. DataNodes, EJBQL queries, callbacks mapped on entities). The tool reports each
such change with "affectsRuntime": true and the information the upgraded project no longer has in details.
Recreating those parts in code is this skill's job — an upgrade isn't done until every such change is addressed.
${CLAUDE_PLUGIN_ROOT}/references/mcp-tools.md — the upgrade_project tool reference and failure modes.${CLAUDE_PLUGIN_ROOT}/references/project-layout.md — locate the project descriptor.${CLAUDE_PLUGIN_ROOT}/references/runtime-api.md — for recreating DataNodes in code.${CLAUDE_PLUGIN_ROOT}/references/query-api.md — for replacing removed queries.The tool needs an absolute path to the top-level project descriptor (cayenne-*.xml). Use project-layout.md
to find it. If there are several descriptors, upgrade each, one at a time.
If the upgrade_project tool is not available, follow "When the MCP server is unavailable" in mcp-tools.md and
stop. Do not upgrade the XML by hand.
The upgrade rewrites the project and DataMap files in place and deletes the files the project no longer needs. Git is the undo.
git status on the project files. If they have uncommitted changes, ask the user to commit or stash them first,
so the upgrade is a clean, reviewable diff that can be reverted. If the project is not under version control, ask
the user to back it up first.upgrade_project({ "projectPath": "<absolute path>" })
status / error.code | Action |
|---|---|
upgraded | Continue to Step 4. |
up_to_date | The XML is current. Skip to Step 6 if the user is upgrading the Cayenne version. |
intermediate_upgrade_needed | The project is too old. Relay the message, which names the older Cayenne release whose Modeler must upgrade it first, and stop. |
downgrade_needed | The project was saved by a newer Cayenne than the MCP server. The user needs a newer CayenneModeler / MCP server. Stop. |
project_not_found, project_parse_failed, upgrade_failed | Relay the message and stop. |
Keep the returned changes — they are the work list for Step 5, and the upgraded files no longer have the
information in details.
fromVersion → toVersion.affectsRuntime: true, with its message and details. These are the parts that were
removed or altered and need code changes.If any change affects the runtime, ask the user whether to proceed with the code changes, or to revert the upgrade
(git restore / git checkout of the project files, which also brings back the deleted ones).
Go through every change with affectsRuntime: true. The message says what happened and what to do; the details
hold the facts. Find the affected application code and fix it. Common cases:
CayenneRuntime and add the
node with defaultDataNode(..) (one node) or addDataNode(.., "map1", ...) (several nodes, linked to the DataMaps
from the DataMap: details lines), per runtime-api.md. Take the JDBC driver, URL, user name, pool sizes and
adapter from details. A password is never reported: take it from the app's existing configuration, or ask the
user — never hardcode a secret. A JNDI DataSource factory means the DataSource comes from JNDI under the name in
DataSource factory parameters. If the app already configures the DataSource in code (e.g. via Bootique or
Spring), only confirm the DataMap linkage.details hold the query definition. Search the code
for the query name (e.g. MappedSelect.query("name")) and replace each use with an equivalent ObjectSelect or
SQLQuery, per query-api.md, or recreate it as a named query in the DataMap via the cayenne-modeling skill.cayenne-modeling),
or set it on the query at the call site.details list event: method pairs, e.g. postAdd: onPostAdd. In the entity's Persistent
class, implement the matching interface from org.apache.cayenne.lifecycle (PostAddAware, PrePersistAware,
PostPersistAware, PreUpdateAware, PostUpdateAware, PreRemoveAware, PostRemoveAware, PostLoadAware),
calling the existing method from the interface method (e.g. onPostAdd()), or renaming it.message. When unsure what the replacement is, look it up in UPGRADE.md (Step 6).If a change can't be addressed (e.g. the code that used a removed part is not in this repository), tell the user explicitly. Never drop a runtime-affecting change silently.
A Cayenne release changes API as well. When the user is upgrading the Cayenne version, read the upgrade guide for the sections between the old and the new version:
Apply the notes that are relevant to the code in this repository (and update the Cayenne version in the build).
cayenne-cgen skill — the templates and the model may have changed.mvn compile / gradle compileJava) and fix what's broken, using UPGRADE.md.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub apache/cayenne --plugin apache-cayenne-69 skills in this plugin
/cayenne-cgenUse this skill whenever the user wants to (re)generate Cayenne entity Java classes from a DataMap. Trigger on phrases like 'generate Java classes', 'regenerate entities', 'run cgen', 'create the entity classes', 'why is the Artist class missing fields', 'where did the `_Abstract*` classes come from', 'sync the entity classes with the model', or any request to materialize Java from the DataMap. Also trigger as a follow-up after modeling changes (someone added an entity, attribute, or relationship and now the Java side is stale). This skill exclusively uses the `cgen_run` MCP tool — it does NOT use `mvn cayenne:cgen` or the Gradle cgen task./cayenne-db-importUse this skill when the user wants to import database schema metadata into a Cayenne DataMap — the *model/mapping only*, not names or Java classes. Trigger on phrases like 'reverse engineer the database', 'import the schema', 'generate a DataMap from my DB', 'add the new tables from the DB into the model', 'import the customer table', 'create entities from these tables', or any request to read database metadata to populate or update a DataMap's XML. This is the only way the DB layer of the model (DbEntity, DbAttribute, DbRelationship) gets created or changed, whatever the size — a full schema, a batch of tables, or a single new table, column or FK. Hand-editing the DB layer in `cayenne-modeling` is allowed only when the user has explicitly said they do not use DB import; Object-layer edits (ObjEntity, ObjAttribute, ObjRelationship) always belong in `cayenne-modeling`. IMPORTANT — scope: this imports the mapping ONLY; it does not clean up the Object-layer names or (re)generate Java classes. When the user wants their whole project brought in line with the DB ('sync my project with the database', 'my schema changed, update everything', 'update my entities/classes from the DB'), that is the end-to-end `cayenne-full-db-sync` skill, which runs this import and then name cleanup and class generation. To regenerate classes alone use `cayenne-cgen`. The skill runs reverse engineering directly via the `dbimport_run` MCP tool when a DBConnector is already configured; otherwise it opens the CayenneModeler GUI via `open_project` to configure the connection first.Other plugins' skills for the same job