Configuration and common problems of jeecg code generator

Keywords: Java Database MySQL JDBC SSL

Take mysql for example:

diver_name=com.mysql.jdbc.Driver
url=jdbc:mysql://192.168.*.*:3306/car?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username=root
password=dp@ssord
database_name=car

jeecg_config.properties

#code_generate_project_path
project_path=D:\\SourceProject\\car
#bussi_package[User defined]
bussi_package=org.jeecg.modules.demo


#default code path
#source_root_package=src
#webroot_package=WebRoot

#maven code path
source_root_package=src.main.java
webroot_package=src.main.webapp

#ftl resource url
templatepath=/jeecg/code-template
system_encoding=utf-8

#db Table id [User defined] 
db_table_id=id

#db convert flag[true/false]
db_filed_convert=true

#page Search Field num [User defined]
page_search_filed_num=1
#page_filter_fields
page_filter_fields=update_time,service_id

 

Run generator SysOneGUI.java:

Enter package name, corresponding entity class name, data table name and description. Prompt if the table does not exist.

Build completed:

log:

16:21:01.408 [AWT-EventQueue-0] DEBUG org.jeecgframework.codegenerate.database.DbReadTableUtil - Database driven: com.mysql.jdbc.Driver
......
16:21:02.582 [AWT-EventQueue-0] INFO org.jeecgframework.codegenerate.generate.impl.CodeGenerateOne - ----jeecg----Code----Generation-----[Single table model: tax_driver_sign]------ Generation complete...

According to the above configuration, the generated files include a full set of entity, mapper, service, controller and front-end vue files under D:\SourceProject\car\src\main\java\org\jeecg\modules\demo\driver, thus liberating our repeated mechanical work. Directory structure:

 

 

 

 

FAQ 1: prompt when generating code: ERROR: table ['t'driver'pay'his] does not exist in the database! Please confirm whether the data source configuration is correct and whether the table name is filled in correctly

It is clear that there is one in db, and the configured db connection is also correct, but this is always prompted. What's the reason?

Here is a detail. jeecg uses the upper case table name to read the table structure information by default, that is, the data table name must be upper case, and then the generator must fill in the upper case table name to generate. MySQL installed under Linux is case sensitive by default, not case sensitive for column names. How can we support the generation of lowercase table names? This sets the database not to be case sensitive for table names. Log in to the server with ROOT, modify MySQL configuration file / etc/my.cnf, and add a line under [mysqld]: lower case table names = 1. Then, restart the database service: systemctl restart mysqld.

 

FAQ 2: configure the useSSL parameter for database connection.

If you have the following prompt when generating code, you can add useSSL=false to the database connection configuration.

16:08:31.625 [AWT-EventQueue-0] DEBUG org.jeecgframework.codegenerate.database.DbReadTableUtil - Database driven: com.mysql.jdbc.Driver
Thu Dec 05 16:08:31 CST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

 

OVER!

Last Sunday (December 1) to participate in the Sanfu Xiangshan cross-country 21 km race. In the cold mountain passion through, the results are good. Attach a picture, hehe!

Posted by invinate on Sat, 07 Dec 2019 18:16:37 -0800