使用claude code迁移Jakarta EE项目--分析使用了JPA的项目

发布时间:2026/6/17 13:20:22
使用claude code迁移Jakarta EE项目--分析使用了JPA的项目 ❯ 列出包含有JPA技术的项目Searched for 1 pattern (ctrlo to expand)● 包含 JPA 技术的项目模块一、Focused 模块 — focused/persistence/15 个示例┌──────────────────────────────────┬───────────────────────────────────────────────────────┬────────────────────────────────────────┐│ 示例 │ 目录 │ 演示的 JPA 特性 │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ column │ focused/persistence/column/ │ Column 注解 │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ converter │ focused/persistence/converter/ │ Converter 类型转换器 │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ createQuery │ focused/persistence/createQuery/ │ EntityManager.createQuery() JPQL │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ entity │ focused/persistence/entity/ │ Entity 实体定义 │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ id │ focused/persistence/id/ │ Id 主键 │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ joinedInheritance │ focused/persistence/joinedInheritance/ │ Inheritance(strategyJOINED) │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ oneToMany │ focused/persistence/oneToMany/ │ OneToMany 一对多 │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ oneToOne │ focused/persistence/oneToOne/ │ OneToOne 一对一 │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ optimisticLock │ focused/persistence/optimisticLock/ │ Version 乐观锁 │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ persistenceContext │ focused/persistence/persistenceContext/ │ PersistenceContext 容器注入 │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ persistenceUnit │ focused/persistence/persistenceUnit/ │ PersistenceUnit EntityManagerFactory │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ resultStream │ focused/persistence/resultStream/ │ Query.getResultStream() │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ singleTableInheritance │ focused/persistence/singleTableInheritance/ │ Inheritance(strategySINGLE_TABLE) │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ tablePerConcreteClassInheritance │ focused/persistence/tablePerConcreteClassInheritance/ │ Inheritance(strategyTABLE_PER_CLASS) │├──────────────────────────────────┼───────────────────────────────────────────────────────┼────────────────────────────────────────┤│ table │ focused/persistence/table/ │ Table 注解 │└──────────────────────────────────┴───────────────────────────────────────────────────────┴────────────────────────────────────────┘二、Focused 模块 — focused/security/8 个示例JPA 辅助认证┌────────────────────────────────────┬──────────────────────────────────────────────────────┬──────────────────────────────────────┐│ 示例 │ 目录 │ JPA 用途 │├────────────────────────────────────┼──────────────────────────────────────────────────────┼──────────────────────────────────────┤│ basicAuth │ focused/security/basicAuth/ │ User/Group 实体 → 内存身份存储预填充 │├────────────────────────────────────┼──────────────────────────────────────────────────────┼──────────────────────────────────────┤│ customFormWithJsf │ focused/security/customFormWithJsf/ │ User/Group 实体 → 自定义表单认证 │├────────────────────────────────────┼──────────────────────────────────────────────────────┼──────────────────────────────────────┤│ filter │ focused/security/filter/ │ User/Group 实体 → 过滤器认证 │├────────────────────────────────────┼──────────────────────────────────────────────────────┼──────────────────────────────────────┤│ formAuth │ focused/security/formAuth/ │ User/Group 实体 → 表单认证 │├────────────────────────────────────┼──────────────────────────────────────────────────────┼──────────────────────────────────────┤│ servlet │ focused/security/servlet/ │ User/Group 实体 → Servlet 认证 │├────────────────────────────────────┼──────────────────────────────────────────────────────┼──────────────────────────────────────┤│ restBasicAuthDBStore │ focused/security/restBasicAuthDBStore/ │ 数据库身份存储 │├────────────────────────────────────┼──────────────────────────────────────────────────────┼──────────────────────────────────────┤│ restBasicAuthDBStoreAndCustomStore │ focused/security/restBasicAuthDBStoreAndCustomStore/ │ 数据库 自定义身份存储 │├────────────────────────────────────┼──────────────────────────────────────────────────────┼──────────────────────────────────────┤│ restBasicAuthCustomStoreHandler │ focused/security/restBasicAuthCustomStoreHandler/ │ 自定义认证处理器 │└────────────────────────────────────┴──────────────────────────────────────────────────────┴──────────────────────────────────────┘三、Tutorial 模块┌─────────────────┬────────────────────────────────────┬────────────┬─────────────────────────────────────────────────────────┐│ 模块 │ 目录 │ JPA 实体数 │ 说明 │├─────────────────┼────────────────────────────────────┼────────────┼─────────────────────────────────────────────────────────┤│ address-book │ tutorial/persistence/address-book/ │ 1 │ Contact 实体basic CRUD │├─────────────────┼────────────────────────────────────┼────────────┼─────────────────────────────────────────────────────────┤│ order │ tutorial/persistence/order/ │ 5 │ CustomerOrder, LineItem, Part, Vendor, VendorPart │├─────────────────┼────────────────────────────────────┼────────────┼─────────────────────────────────────────────────────────┤│ roster │ tutorial/persistence/roster/ │ 5 │ League, Player, Team, SummerLeague, WinterLeague (继承) │├─────────────────┼────────────────────────────────────┼────────────┼─────────────────────────────────────────────────────────┤│ phonebilling │ tutorial/batch/phonebilling/ │ 2 │ CallRecord, PhoneBill (Batch JPA) │├─────────────────┼────────────────────────────────────┼────────────┼─────────────────────────────────────────────────────────┤│ rsvp │ tutorial/jaxrs/rsvp/ │ 3 │ Event, Person, Response (REST JPA) │├─────────────────┼────────────────────────────────────┼────────────┼─────────────────────────────────────────────────────────┤│ customer │ tutorial/jaxrs/customer/ │ 2 │ Address, Customer (REST JPA) │├─────────────────┼────────────────────────────────────┼────────────┼─────────────────────────────────────────────────────────┤│ clientmdbentity │ tutorial/jms/clientmdbentity/ │ 1 │ SetupOffice (JMS MDB JPA) │├─────────────────┼────────────────────────────────────┼────────────┼─────────────────────────────────────────────────────────┤│ producerfields │ tutorial/cdi/producerfields/ │ 1 │ ToDo (CDI JPA Producer Field) │└─────────────────┴────────────────────────────────────┴────────────┴─────────────────────────────────────────────────────────┘四、综合案例Case Studies┌─────────────────┬────────────────────────────────────────┬───────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│ 案例 │ 目录 │ JPA │ 说明 ││ │ │ 实体数 │ │├─────────────────┼────────────────────────────────────────┼───────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────┤│ Dukes │ tutorial/case-studies/dukes-bookstore/ │ 1 │ Book 实体最简 JPA JSF ││ Bookstore │ │ │ │├─────────────────┼────────────────────────────────────────┼───────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────┤│ Dukes Forest │ tutorial/case-studies/dukes-forest/ │ 9 │ Administrator, Category, Customer, CustomerOrder, Groups, OrderDetail, OrderStatus, Person, Product — ││ │ │ │ 完整电商数据模型 │├─────────────────┼────────────────────────────────────────┼───────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────┤│ Dukes Tutoring │ tutorial/case-studies/dukes-tutoring/ │ 8 │ Address, Administrator, Guardian, Person, PersonDetails, StatusEntry, Student, TutoringSession │└─────────────────┴────────────────────────────────────────┴───────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────┘五、Applications┌─────────┬───────────────────────┬────────────┬───────────────────────────────────────────────────────┐│ 应用 │ 目录 │ JPA 实体数 │ 说明 │├─────────┼───────────────────────┼────────────┼───────────────────────────────────────────────────────┤│ Kickoff │ applications/kickoff/ │ 3 │ Credentials, LoginToken, Person — 用户认证 业务模板 │└─────────┴───────────────────────┴────────────┴───────────────────────────────────────────────────────┘---汇总┌──────────────────────────┬────────┬──────────────────────┐│ 分类 │ 模块数 │ persistence.xml 数量 │├──────────────────────────┼────────┼──────────────────────┤│ Focused (Persistence) │ 15 │ 15 │├──────────────────────────┼────────┼──────────────────────┤│ Focused (Security JPA) │ 8 │ 8 │├──────────────────────────┼────────┼──────────────────────┤│ Tutorial (Persistence) │ 3 │ 3 │├──────────────────────────┼────────┼──────────────────────┤│ Tutorial (跨技术 JPA) │ 5 │ 5 │├──────────────────────────┼────────┼──────────────────────┤│ Case Studies │ 3 │ 2 │├──────────────────────────┼────────┼──────────────────────┤│ Applications │ 1 │ 2 (main test) │├──────────────────────────┼────────┼──────────────────────┤│ 合计 │ 35 │ 35 │└──────────────────────────┴────────┴──────────────────────┘所有模块在迁移到 PostgreSQL 时都需要修改 persistence.xml 中的数据源配置并检查 DDL 生成策略是否与 PostgreSQL 兼容。