当前位置:网站首页>Idea generates entity classes from database tables
Idea generates entity classes from database tables
2022-06-28 06:00:00 【Coder without code】
original text ip:https://blog.csdn.net/crazyman2010/article/details/69668484
Configuration database
Open database settings View->Tool Windows->Database
On the right will open a Database The window of , Click on +, choice Data Source, Choose your own database type , Then fill in the parameters , You can see all the tables in your database .
Modify the script
By default , Use script generated files , There are some problems in naming , such as user_name surface , Will generate User_name.java, The same is true for the attributes inside , But if we want to generate UserName.java Words , If you modify the script .
Right click on one of the tables , choice Script Extensions->Goto Scripts Directory, The left will switch to Scratches window , open Generate POJOs.clj, Modify the following code :
(defn- java-name [name]
(apply str (map clojure.string/capitalize (re-seq #"\w+" name))))It is amended as follows
(defn- java-name [name]
; Remove it here _ Symbol , And capitalize _ The first letter after the symbol
(apply str (map clojure.string/capitalize (map #(clojure.string/replace % #"_" "") (re-seq #"[^_]+" name)))))You can also modify other things in this script , For example, remove the prefix information of the table
(defn- generate-pojo [directory table]
(let [class-name (java-name (subs (.getName table) 4)) ; Remove it here xxx_ These characters - 1
- 2
This script uses clojure Compiling , Syntax and functions can be queried here :
http://clojuredocs.org/
After modification , On related tables , The right choice Script Extensions->Generate POJOs.clj, Just save it in the pop-up window .
If you use the latest version idea, Namely idea 2018.2. Then there is no need to modify the script . It removes the underline directly .
边栏推荐
- Openharmony gnawing paper growth plan -- json-rpc
- Ape pink ape power - Developer activity attack!
- Using pytorch and tensorflow to calculate the confusion matrix of classification model
- Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
- windows上安装redis并永久修改密码,及ssm框架集成redis
- Xcode13.3.1 error reported after pod install
- Mysql-16-subquery
- 重载,重写的区别,抽象类,接口的区别
- [CAD drawing Video] AutoCAD 2014 master's way
- 19 fonctions de perte d'apprentissage profond
猜你喜欢
![RL practice (0) - and the platform xinchou winter season [rule based policy]](/img/dc/10d615c64123475fea180e035095ff.png)
RL practice (0) - and the platform xinchou winter season [rule based policy]

容量调度绝对值配置队列使用与避坑

5g network overall architecture

Drop down box for implementation

若依实现下拉框

Apple MDM Bypass 免越狱绕过MDM配置锁 免费

Where is the era bonus for developers?

How the third-party libraries in cocoapod reference local header files

Common basic functions of Oracle

Data middle office: six questions data middle office
随机推荐
Yygh-8-appointment registration
高质量国产立体声编解码器CJC8988,Pin to Pin替代WM8988
Data middle office: an article that takes you to understand data middle office in simple terms
重载,重写的区别,抽象类,接口的区别
bash install.sh ********错误
Yygh-6-wechat login
Mysql-17- create and manage tables
Maskrcnn,fast rcnn, faster rcnn优秀视频
Qtcanpool knowledge 07:ribbon
Deep learning 19 loss functions
Main functions of 5ggnb and ng ENB
High quality domestic stereo codec cjc8988, pin to pin replaces wm8988
The windows environment redis uses AOF persistence and cannot generate an AOF file. After generation, the content of the AOF file cannot be loaded
预训练模型参数不匹配
Introduction to uicollectionviewdiffabledatasource and nsdiffabledatasourcesnapshot
Flink 窗口机制 (两次等待, 最后兜底)
1404. 将二进制表示减到1的步骤数
5GgNB和ng-eNB的主要功能
【MYSQL】所有查询表中有2千万数据--sql如何优化
学术搜索相关论文