JasonXu999 opened a new issue, #18868:
URL: https://github.com/apache/shardingsphere/issues/18868

   采用mybaitis+sharding-jdbc。程序运行后,修改某个表字段顺序,最终导致mybatis ORM映射出错!
   比如程序运行后:
   1、执行 select * from user。这个时候映射是正常的。
   2、修改user表的某个字段的顺序。
   3、再次执行:select * from user。这个时候字段映射关系会出错。
   
原因为:ShardingSphereResultSet中,运行到hasSelectExpandProjections(),使用了缓存的ProjectionsContext来构造字段映射关系。
       private Map<String, Integer> createColumnLabelAndIndexMap(final 
ResultSetMetaData resultSetMetaData) throws SQLException {
           if (hasSelectExpandProjections()) {
               return createColumnLabelAndIndexMapWithExpandProjections();
           }
           Map<String, Integer> result = new 
CaseInsensitiveMap<>(resultSetMetaData.getColumnCount(), 1);
           for (int columnIndex = resultSetMetaData.getColumnCount(); 
columnIndex > 0; columnIndex--) {
               result.put(resultSetMetaData.getColumnLabel(columnIndex), 
columnIndex);
           }
           return result;
       }
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to