SimpleFlatMapper:如何将 HashSet 更改为 TreeSet

问题描述

我正在使用 SimpleFlatMapper查询结果映射到如下所示的对象列表:

    ResultSetExtractor<List<T>> resultSetExtractor =
                        JdbcTemplateMapperFactory
                                .newInstance()
                                .addKeys("id")
                                .newResultSetExtractor(MyObjbect.class);
    
                return emptyIfNull(jdbcTemplate.query("select * from object_table",resultSetExtractor));


    MyObjbect {
     String id;
     Set<AnotherObject> anotherObjects;
    }
    
    @Value
    AnotherObject {
      String prop1;
      String prop2
    }

如您所见,我在 id 中没有 AnotherObject,因此我使用了 Set 来消除重复项。

现在我必须通过 anotherObjects 订购 prop1,所以我需要告诉 SimpleFlatMapper 使用 TreeSet 而不是 HashSet。

有人知道如何配置 SimpleFlatMapper 以使用 TreeSet 吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)