MyBatis saves CLOB type data to Oracle/MySQL database

  • Mybatis saves the operation of the database CLOB type to the oracle library

When using varchar2 type to store strings in oracle, it is found that the maximum length of storage is 4000 characters, and an error will be reported if it is longer.

Using the clob type, 4g content can be stored, and mybatis can automatically parse the clob type. Just set the data type of the clob field to: jdbcType=CLOB when writing the insert and update statements.

As for javabeans, the clob field can be received with the String type .

Writing a large field is no different from ordinary writing, but the database field type needs to be clob, and an error will be reported if it is blob

Reference address

https://blog.csdn.net/zengdeqing2012/article/details/78864922

https://blog.csdn.net/yan3013216087/article/details/79013923

  • Mybatis saves the operation of the database CLOB type to the MySQL library

Define the String type of the "Configuration File Information" field in the entity properties. The default String type is 256 bytes. When the content we store is too long, it will prompt an error

Solution:

Add annotations to the field properties to modify the default storage length

The table structure field type in the database is changed to longText

Reference address

https://www.cnblogs.com/mr-wuxiansheng/p/6414972.html

Application scenarios

When the rich text editor saves information, when the content in the rich text editor is relatively small, there is no problem in adding and editing operations; when there is a large amount of content, the system will prompt "value too long" similar error. As a result, the operation of adding or editing cannot be performed.

Therefore, it is necessary to modify the database structure field type to store large text data, so that the allowable length of the fields of the rich text editor details is greatly increased.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324846047&siteId=291194637