singhpk234 commented on code in PR #3334:
URL: https://github.com/apache/polaris/pull/3334#discussion_r2652085204


##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcBasePersistenceImpl.java:
##########
@@ -431,15 +448,34 @@ public PolarisBaseEntity lookupEntityByName(
             name,
             "realm_id",
             realmId);
-    return getPolarisBaseEntity(
+    QueryGenerator.PreparedQuery query =
         QueryGenerator.generateSelectQuery(
-            ModelEntity.getAllColumnNames(schemaVersion), 
ModelEntity.TABLE_NAME, params));
+            ModelEntity.getAllColumnNames(schemaVersion), 
ModelEntity.TABLE_NAME, params);
+    return getPolarisBaseEntity(query, connection);
   }
 
   @Nullable
   private PolarisBaseEntity getPolarisBaseEntity(QueryGenerator.PreparedQuery 
query) {
+    return getPolarisBaseEntity(query, null);
+  }
+
+  /**
+   * Execute entity lookup, optionally using an existing connection to 
maintain transaction
+   * consistency.
+   *
+   * @param query the prepared query to execute
+   * @param connection optional connection to reuse; if null, a new connection 
will be obtained
+   * @return the entity if found, null otherwise
+   */
+  @Nullable
+  private PolarisBaseEntity getPolarisBaseEntity(
+      QueryGenerator.PreparedQuery query, @Nullable Connection connection) {
     try {
-      var results = datasourceOperations.executeSelect(query, new 
ModelEntity(schemaVersion));
+      List<PolarisBaseEntity> results =
+          connection != null

Review Comment:
   Attempted this in commit: 
https://github.com/apache/polaris/pull/3334/changes/192d7870869216fe24ba50a1a7fb36005c698d48,
 wdyt ? 



-- 
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