Fix controllo SQLServerConnection in EntityBase
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good

This commit is contained in:
2025-07-31 10:08:43 +02:00
committed by GiuseppeS
parent 8caa0c924b
commit fce976b2df

View File

@@ -1361,11 +1361,11 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
public void insertEntity() throws Exception { public void insertEntity() throws Exception {
java.sql.Connection con = connection.getConnection(); java.sql.Connection con = connection.getConnection();
if (!(con instanceof SQLServerConnection)) { if (!con.isWrapperFor(SQLServerConnection.class)) {
throw new Exception("Impossibile processare una entity su una connessione diversa da SQL Server"); throw new Exception("Impossibile processare una entity su una connessione diversa da SQL Server");
} }
SQLServerConnection sqlServerConnection = (SQLServerConnection) con; SQLServerConnection sqlServerConnection = con.unwrap(SQLServerConnection.class);
if (nativeSql != null) { if (nativeSql != null) {
SQLServerPreparedStatement pstm = (SQLServerPreparedStatement) sqlServerConnection.prepareStatement(nativeSql); SQLServerPreparedStatement pstm = (SQLServerPreparedStatement) sqlServerConnection.prepareStatement(nativeSql);
@@ -1489,7 +1489,7 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
public void updateEntity() throws Exception { public void updateEntity() throws Exception {
java.sql.Connection con = connection.getConnection(); java.sql.Connection con = connection.getConnection();
if (!(con.isWrapperFor(SQLServerConnection.class))) { if (!con.isWrapperFor(SQLServerConnection.class)) {
throw new Exception("Impossibile processare una entity su una connessione diversa da SQL Server"); throw new Exception("Impossibile processare una entity su una connessione diversa da SQL Server");
} }