英文:
Best way to convert Cassandra ResultSet to java objects in OSS driver
问题
我们正在从Cassandra DSE迁移到OSS驱动程序的过程中,痛点是将结果集转换为Java对象列表。我不想使用Mapper注解,详细信息请参考这里。
那么,将ResultSet转换为Java对象列表的最高效方式是什么?任何建议都会非常感激。
英文:
We are in the process of migrating from Cassandra DSE to OSS driver and the pain point is converting the result set into a list of Java objects. I don't want to use Mapper annotation, like detailed here
So what is the most efficient way to convert ResultSet into list of java objects? Any suggestion highly appreciated
答案1
得分: 1
如果您不想使用Mapper,只需编写一个转换函数,该函数将接受Row,提取所有必要的列,并返回从提取的数据构建的POJO...我看不到其他方法,除非编写一个特定版本的对象映射器,该映射器将使用反射来匹配POJO的字段名称与列名称。
英文:
If you don't want to use Mapper then just need to write converting function that will take Row, extract all necessary columns, and return POJO constructed from teh extracted data... I don't see other ways, except writing an adhoc version of object mapper that would use the reflection to match POJO's field names with the column names
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论