简体   繁体   English

从IntelliJ中的数据库自动创建POJO类

[英]Auto create POJO class from database in IntelliJ

Is there any function in IntelliJ that allows me to generate simple POJO class from database tables (currently using PSQL)? IntelliJ中是否有任何功能允许我从数据库表(当前使用PSQL)生成简单的POJO类? I saw some similar example in Eclipse using "hbm2java". 我在Eclipse中使用“ hbm2java”看到了一些类似的示例。

Yes, it's possible to generate simple POJOs from Database Tables in IntelliJ. 是的,可以从IntelliJ中的数据库表中生成简单的POJO。

Just follow this instruction: 只需遵循以下说明:

  1. Connect your database to IntelliJ. 将数据库连接到IntelliJ。
  2. Right click the tables you want to generate your POJOs for 右键单击要为其生成POJO的表
  3. Right Click on your selection --> Scripted Extensions --> Generate POJOs.groovy 右键单击您的选择->脚本扩展->生成POJOs.groovy
  4. Select where to save your POJO classes 选择保存POJO类的位置
  5. Press OK and your POJO files will be created. 按确定,您的POJO文件将被创建。

Hope this helps. 希望这可以帮助。 - Tested on IntelliJ 2019.1 -在IntelliJ 2019.1上测试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM