You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否从现有JHipster项目重新生成JDL文件并同步手动修改的实体?

Answer

Yes, you can regenerate a JDL file from your existing project and sync it with the current entity state, along with updating the .jhipster JSON files. Here's how to do it:

Step 1: Reverse-engineer your entities to JDL

JHipster supports reverse-engineering JPA entity classes or your database schema into a JDL file.

  • To generate JDL from your existing entity code:
    Run the following command, replacing the package path with where your entity classes are located:

    jhipster jdl reverse --package-name com.yourproject.domain
    

    This creates a reverse-engineered.jdl file reflecting your current entity structure.

  • Alternatively, if your database matches your entity code, reverse-engineer directly from the database:

    jhipster db reverse
    

    Ensure your database connection settings are correctly configured in application.yml/application.properties first.

Step 2: Refine the generated JDL

The reverse-engineered JDL may miss JHipster-specific configurations (like relationship types, pagination, DTO settings, or filter options) that were set manually. Review the file and adjust these details to match your project's actual setup.

Step 3: Update .jhipster JSON files

Once your JDL is accurate, import it to sync the .jhipster JSON files (which JHipster uses to track entity state):

jhipster import-jdl reverse-engineered.jdl

This overwrites existing .jhipster files, so back them up before running the command.

Step 4: Verify consistency

After importing the JDL, confirm the generated .jhipster JSON files align with your entity code. You can now use standard JHipster commands (like jhipster entity <EntityName>) to modify entities, keeping your JDL, JSON files, and code in sync moving forward.

Important Notes

  • Always back up your project before running these commands to avoid losing manual customizations.
  • Reverse engineering won’t capture every custom change (like custom methods, non-standard annotations, or business logic), so retain those manually in your entity classes.
  • If your entity code and database are out of sync, align them first before reverse-engineering.

内容的提问来源于stack exchange,提问作者Kevion

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.18 10:25:32