1.Error configuring ClickHouse or any other database data source
Solution: Add @dynamicdatasource (dataSource = “XXXXXX”) above the clickhouse method called by the service layer.
2. An error ` ‘org. Springframework. Dao. InvalidDataAccessApiUsageException:
Error updating database. Cause: java.sql.SQLFeatureNotSupportedException SQL: insert into xxxxxxxxx Cause: java.sql.SQLFeatureNotSupportedException ; null; Nested exception is Java. SQL. ` SQLFeatureNotSupportedException ‘
Cause: ClickHouse added primary key statement preprocessing error
Solution: Set in Mapper
3. If you pass multiple arrays, you can pass a List nested directly
4. When accessing an application from another application, you should look at @configurationProperties (prefix = “api.fnfinanceJobService “) at the top of the corresponding location to determine the prefix configured in the properties file to find the application name
5. Copy the SQL when you test for different data
Splicing together the data that you already know and querying it in the database client, and then breaking it down and seeing what the cause of the problem is that you didn’t find in the code
6. When several query fields are added to the mapper. XML file, no return value is returned because mapping needs to be added
7. In general, dependencies are inherited
For example, if the Web inherits poM dependencies from several other modules, do not add the same dependencies to the Web, otherwise it will cause dependency conflicts and will not work
8. Nginx needs to be enabled for local debugging when different applications provide pages
Mysql > alter table create table
CREATE TABLE mmc_order_bill_csDRf01001 (id BIGint (20) NOT NULL AUTO_INCREMENT COMMENT ‘increment ID ‘, Insert_dt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘CURRENT_TIMESTAMP ‘, Update_dt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘update time ‘, Business_dt TIMESTAMP NOT NULL DEFAULT ‘0000-00-00 00:00:00’ COMMENT ‘ Store_id varchar(100) NOT NULL DEFAULT ‘0’ COMMENT ‘ HM001’, biz_order_id bigINT (20) NOT NULL DEFAULT 0 COMMENT ‘order_id ‘, Sub_order_id bigint(20) NOT NULL DEFAULT 0 COMMENT ‘sub_order_id ‘, Main_global_id bigint(20) NOT NULL DEFAULT 0 COMMENT ‘main_global_id ‘, PRIMARY KEY (ID), KEY idx_tb_biz_order_id USING BTREE (biz_order_id), KEY item_code (item_code) ENGINE = InnoDB AUTO_INCREMENT = 10000 CHARSET = utf8 COMMENT ‘xx ‘ Fields are wrapped with ‘. Default fields and remarks are wrapped with ‘
10. : Insert into on duplicate key updateIf the corresponding operation table has fields such as text, the related syntax may cause the database to crash and restart
11. When the time in the database is timestamp, when the query is passed, it must also pass timestamp query
SQL > select * from table where most columns are null and no values are displayed:
Check whether the mapping of these fields is correct, and check whether the query uses a resultMap or a resultType. If the query uses a resultType, the data field may be displayed as NULL. The reason is that when using resultMap, resultMap=”BaseResultMap”, the BaseResultMap uses this statement to convert the hump, so there is no problem in displaying the hump
13. If an error occurs during operation
ERROR StatusLogger Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender for element RollingRandomAccessFile. java.lang.IllegalStateException: Infinite loop in property interpolation of
{APP_NAME}/event.log: APP_NAME->sys:APP_NAME
-dapp_name = application name (default can be written to default)
14. Instead of using “=” directly, use equels or longValue ().
For example: Totalamt.longValue ()! = refundCountAmt.getTotalAmount().longValue()
15. When doing division operations with BigDecimal, you must consider that when you cannot divide,
Error: BigDecimal AmtDivideGuestAmt = new BigDecimal(refundamout). Divide (new BigDecimal(guestAmount));
Correct: BigDecimal AmtDivideGuestAmt = new BigDecimal(refundAmount).divide(new BigDecimal(guestAmount),2,BigDecimal.ROUND_HALF_UP);
So if you’re going to do a subsequent multiplication, you’re going to have to add the decimal after the multiplication to make it more precise and there’s a.setScale(0, BigDecimal.ROUND_HALF_UP) method
Mysql > alter table select * from unique key;
(1) : DuplicateKeyException (2) : MySQLIntegrityConstraintViolationException (3) : DataIntegrityViolationException