问题:
rg.springframework.dao.DataIntegrityViolationException: Error attempting to get column 'create_time' from result set. Cause: java.sql.SQLDataException: Cannot convert string 'WECHAT' to java.sql.Timestamp value
; ]; Cannot convert string 'WECHAT' to java.sql.Timestamp value; nested exception is java.sql.SQLDataException: Cannot convert string 'WECHAT' to java.sql.Timestamp value
原因:
我union前后的两个语句的字段排列不一致,导致转换成实体类出错。
(Select info.order_id,
info.status,
info.no,
'1' as type,
info.create_time,
info.trade_type,
from t_info info
)
union all
(select refun.id,
refun.status,
refun.no,
'2' as type,
refun.trade_type,
refunpay.create_time,
from t_refund_info refun)
连个select 语句的查询结果必须字段一致,顺序一致。



