dimas-b commented on code in PR #1434:
URL: https://github.com/apache/polaris/pull/1434#discussion_r2056934252


##########
extension/persistence/relational-jdbc/src/main/java/org/apache/polaris/extension/persistence/relational/jdbc/DatasourceOperations.java:
##########
@@ -125,10 +128,8 @@ public <T, R> List<R> executeSelect(
         ResultSet resultSet = statement.executeQuery(query)) {
       List<R> resultList = new ArrayList<>();
       while (resultSet.next() && resultList.size() < limit) {
-        Converter<T> object =
-            (Converter<T>)
-                entityClass.getDeclaredConstructor().newInstance(); // Create 
a new instance
-        R entity = transformer.apply(object.fromResultSet(resultSet));
+        Converter<T> model = (Converter<T>) createModelInstance(entityClass);

Review Comment:
   How about changing `entityClass` to `Function<ResultSet, R> converter` and 
removing `transformer`.
   
   Then:
   ```
   public static ModelEntity fromResultSet0(ResultSet r)  {
       return ModelEntity.builder()
           ....
   ```
   
   End result no reflection, not if/else, one less method param, simpler entity 
classes.



-- 
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: issues-unsubscr...@polaris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to