From f709cca2b1f6b48c7ee909c0750571ebb9aea7d0 Mon Sep 17 00:00:00 2001 From: Michael Gentry Date: Mon, 5 May 2025 14:41:18 -0400 Subject: [PATCH] Updated PK generators to avoid needlessly calling super.methods() --- .../org/apache/cayenne/dba/mysql/MySQLPkGenerator.java | 4 ++-- .../apache/cayenne/dba/oracle/OraclePkGenerator.java | 4 ++-- .../apache/cayenne/dba/sybase/SybasePkGenerator.java | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cayenne/src/main/java/org/apache/cayenne/dba/mysql/MySQLPkGenerator.java b/cayenne/src/main/java/org/apache/cayenne/dba/mysql/MySQLPkGenerator.java index 31489aff9e..c8a965360e 100644 --- a/cayenne/src/main/java/org/apache/cayenne/dba/mysql/MySQLPkGenerator.java +++ b/cayenne/src/main/java/org/apache/cayenne/dba/mysql/MySQLPkGenerator.java @@ -157,7 +157,7 @@ protected long getLongPrimaryKey(Statement statement, String entityName) throws statement.execute(lockString); // select - String selectString = super.pkSelectString(entityName); + String selectString = pkSelectString(entityName); adapter.getJdbcEventLogger().log(selectString); long pk; try (ResultSet rs = statement.executeQuery(selectString)) { @@ -172,7 +172,7 @@ protected long getLongPrimaryKey(Statement statement, String entityName) throws } // update - String updateString = super.pkUpdateString(entityName) + " AND NEXT_ID = " + pk; + String updateString = pkUpdateString(entityName) + " AND NEXT_ID = " + pk; adapter.getJdbcEventLogger().log(updateString); int updated = statement.executeUpdate(updateString); // optimistic lock failure... diff --git a/cayenne/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java b/cayenne/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java index 9f544f87bf..798985e1c8 100644 --- a/cayenne/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java +++ b/cayenne/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java @@ -193,9 +193,9 @@ protected int pkCacheSize(DbEntity entity) { && keyGenerator.getGeneratorName() != null) { Integer size = keyGenerator.getKeyCacheSize(); - return (size != null && size >= 1) ? size : super.getPkCacheSize(); + return (size != null && size >= 1) ? size : getPkCacheSize(); } else { - return super.getPkCacheSize(); + return getPkCacheSize(); } } diff --git a/cayenne/src/main/java/org/apache/cayenne/dba/sybase/SybasePkGenerator.java b/cayenne/src/main/java/org/apache/cayenne/dba/sybase/SybasePkGenerator.java index c26f4e0814..f7bd8af663 100644 --- a/cayenne/src/main/java/org/apache/cayenne/dba/sybase/SybasePkGenerator.java +++ b/cayenne/src/main/java/org/apache/cayenne/dba/sybase/SybasePkGenerator.java @@ -100,8 +100,8 @@ protected String pkTableCreateString() { @Override public void createAutoPk(DataNode node, List dbEntities) throws Exception { super.createAutoPk(node, dbEntities); - super.runUpdate(node, safePkProcDrop()); - super.runUpdate(node, unsafePkProcCreate()); + runUpdate(node, safePkProcDrop()); + runUpdate(node, unsafePkProcCreate()); } @Override @@ -139,8 +139,8 @@ public List createAutoPkStatements(List dbEntities) { */ @Override public void dropAutoPk(DataNode node, List dbEntities) throws Exception { - super.runUpdate(node, safePkProcDrop()); - super.runUpdate(node, safePkTableDrop()); + runUpdate(node, safePkProcDrop()); + runUpdate(node, safePkTableDrop()); } @Override @@ -170,7 +170,7 @@ protected long longPkFromDatabase(DataNode node, DbEntity entity) throws Excepti try (Connection connection = node.getDataSource().getConnection()) { try (CallableStatement statement = connection.prepareCall("{call auto_pk_for_table(?, ?)}")) { statement.setString(1, entity.getName()); - statement.setInt(2, super.getPkCacheSize()); + statement.setInt(2, getPkCacheSize()); // can't use "executeQuery" per http://jtds.sourceforge.net/faq.html#expectingResultSet statement.execute();