baiyangtx commented on code in PR #3341:
URL: https://github.com/apache/amoro/pull/3341#discussion_r1858546054


##########
amoro-ams/src/main/java/org/apache/amoro/server/persistence/converter/Object2ByteArrayConvert.java:
##########
@@ -31,14 +30,17 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Types;
+import java.util.Locale;
 
 public class Object2ByteArrayConvert<T> implements TypeHandler<T> {
 
   @Override
   public void setParameter(PreparedStatement ps, int i, T parameter, JdbcType 
jdbcType)
       throws SQLException {
+    String dbName =
+        
ps.getConnection().getMetaData().getDatabaseProductName().toLowerCase(Locale.ENGLISH);
     if (parameter == null) {
-      if 
(SqlSessionFactoryProvider.getDbType().equals(AmoroManagementConf.DB_TYPE_POSTGRES))
 {
+      if (dbName.startsWith(AmoroManagementConf.DB_TYPE_POSTGRES)) {

Review Comment:
   I referred to the implementation of Jetty.
   
   
https://github.com/jetty/jetty.project/blob/7f611622f6f821b4c55930939c85444d765165f4/jetty-core/jetty-session/src/main/java/org/eclipse/jetty/session/DatabaseAdaptor.java#L85
   
   This is exactly the framework that Javalin relies on. I inherited this 
class, but only modified the table names and field names.
   



##########
amoro-ams/src/main/java/org/apache/amoro/server/persistence/converter/Object2ByteArrayConvert.java:
##########
@@ -31,14 +30,17 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Types;
+import java.util.Locale;
 
 public class Object2ByteArrayConvert<T> implements TypeHandler<T> {
 
   @Override
   public void setParameter(PreparedStatement ps, int i, T parameter, JdbcType 
jdbcType)
       throws SQLException {
+    String dbName =
+        
ps.getConnection().getMetaData().getDatabaseProductName().toLowerCase(Locale.ENGLISH);
     if (parameter == null) {
-      if 
(SqlSessionFactoryProvider.getDbType().equals(AmoroManagementConf.DB_TYPE_POSTGRES))
 {
+      if (dbName.startsWith(AmoroManagementConf.DB_TYPE_POSTGRES)) {

Review Comment:
   I referred to the implementation of Jetty.
   
   
https://github.com/jetty/jetty.project/blob/7f611622f6f821b4c55930939c85444d765165f4/jetty-core/jetty-session/src/main/java/org/eclipse/jetty/session/DatabaseAdaptor.java#L85
   
   This is exactly the framework that Javalin relies on. I inherited this 
class, but only modified the table names and field names.



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