Pit stepping record – after Lombok is annotated with builder, mybatis cannot recognize the correct type of field
After adding Lombok to the entity class, sometimes we will use @ builder annotation, so we don’t need to write too many set methods to define the attribute content, which makes our code more elegant. Once the @ builder annotation is added to the entity class, it will cause problems in our mybatis mapping database fields
The questions are as follows
org.springframework.dao.DataIntegrityViolationException: Error attempting to get column 'username' from result set. Cause: java.sql.SQLDataException: Cannot determine value type from string 'zhangsa'
; Cannot determine value type from string 'zhangsa'; nested exception is java.sql.SQLDataException: Cannot determine value type from string 'zhangsa'
note: when using @ builder annotation, a full parameter structure will be generated, resulting in the disappearance of no parameter structure
terms of settlement
- we can directly remove @ builder annotation, and there will be no problem for mybatis to query the database. We can generate parametric and nonparametric constructs in entity classes (you can add them manually or add annotations
@ allargsconstructor
, @ noargsconstructor
) OL>
if it is still abnormal, you should check whether your entity class and database type mapping do not correspond
Hold fireworks to seek life, poetic to seek love
Read More:
- Error attempting to get column from result set
- Error attempting to get column ‘failure_msg‘ from result set
- Error attempting to get column ‘STAFF_NAME’ from result set
- Error attempting to get column time from result set. Cause: java.sql.SQLFe
- Error reporting when Lombok @ data and @ builder are used together
- How to Solve mybatis returns null when querying Oracle database with char type field
- [idea] error occurred when using @ data annotation in Lombok: no related get / set method was found
- Mybatis integrates Oracle query and reports an error in the datetime type field
- How to Fix SQL Error: 1054, SQLState: 42S22 Unknown column ‘markcardex0_.art_service_time’ in ‘field list’
- Cause: java.sql.BatchUpdateException: Unknown column ‘xxx‘ in ‘field list‘
- MySQL error: column ‘ID’ in field list is ambiguous
- Use xx [‘xx ‘] = XX to set field value or does not support field: XXX
- Solution to the problem that SQL database query result field contains new line character, which leads to copy to excel dislocation
- When the mybatis field contains an expression, an error is reported when it is stored in the database
- Using Lombok to compile and report errors
- @Solution to get / set error in eclipse after using data annotation
- Error type referred to is not an annotation type:RedisCache
- Error in idea @ data entity class get / set
- On the usage of ‘ref.stor.type search’ field in SAP WM movement type
- In the SQL query statement, add the column that does not exist in the table and set the fixed value of the column