mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
No effective change - code cleanup - remove unused throws exception
This commit is contained in:
@@ -1,13 +1,5 @@
|
||||
package com.avaje.ebeaninternal.server.core;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.OptimisticLockException;
|
||||
|
||||
import com.avaje.ebean.ValuePair;
|
||||
import com.avaje.ebean.annotation.ConcurrencyMode;
|
||||
import com.avaje.ebean.bean.EntityBean;
|
||||
@@ -29,6 +21,12 @@ import com.avaje.ebeaninternal.server.persist.dml.GenerateDmlRequest;
|
||||
import com.avaje.ebeaninternal.server.transaction.BeanDelta;
|
||||
import com.avaje.ebeaninternal.server.transaction.BeanPersistIdMap;
|
||||
|
||||
import javax.persistence.OptimisticLockException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* PersistRequest for insert update or delete of a bean.
|
||||
*/
|
||||
@@ -506,7 +504,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
/**
|
||||
* Check for optimistic concurrency exception.
|
||||
*/
|
||||
public final void checkRowCount(int rowCount) throws SQLException {
|
||||
public final void checkRowCount(int rowCount) {
|
||||
if (rowCount != 1) {
|
||||
String m = Message.msg("persist.conc2", "" + rowCount);
|
||||
throw new OptimisticLockException(m, null, bean);
|
||||
@@ -540,7 +538,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
/**
|
||||
* Post processing.
|
||||
*/
|
||||
public void postExecute() throws SQLException {
|
||||
public void postExecute() {
|
||||
|
||||
if (controller != null) {
|
||||
controllerPost();
|
||||
|
||||
@@ -66,7 +66,7 @@ public final class PersistRequestCallableSql extends PersistRequest {
|
||||
/**
|
||||
* Note the rowCount of the execution.
|
||||
*/
|
||||
public void checkRowCount(int count) throws SQLException {
|
||||
public void checkRowCount(int count) {
|
||||
this.rowCount = count;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public final class PersistRequestCallableSql extends PersistRequest {
|
||||
/**
|
||||
* Perform post execute processing for the CallableSql.
|
||||
*/
|
||||
public void postExecute() throws SQLException {
|
||||
public void postExecute() {
|
||||
|
||||
if (transaction.isLogSummary()) {
|
||||
String m = "CallableSql label[" + callableSql.getLabel() + "]" + " rows[" + rowCount+ "]" + " bind[" + bindLog + "]";
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.avaje.ebeaninternal.server.core;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.avaje.ebeaninternal.api.SpiEbeanServer;
|
||||
import com.avaje.ebeaninternal.api.SpiTransaction;
|
||||
import com.avaje.ebeaninternal.api.SpiUpdate;
|
||||
@@ -59,7 +57,7 @@ public final class PersistRequestOrmUpdate extends PersistRequest {
|
||||
/**
|
||||
* No concurrency checking so just note the rowCount.
|
||||
*/
|
||||
public void checkRowCount(int count) throws SQLException {
|
||||
public void checkRowCount(int count) {
|
||||
this.rowCount = count;
|
||||
}
|
||||
|
||||
@@ -79,7 +77,7 @@ public final class PersistRequestOrmUpdate extends PersistRequest {
|
||||
/**
|
||||
* Perform post execute processing.
|
||||
*/
|
||||
public void postExecute() throws SQLException {
|
||||
public void postExecute() {
|
||||
|
||||
OrmUpdateType ormUpdateType = ormUpdate.getOrmUpdateType();
|
||||
String tableName = ormUpdate.getBaseTable();
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.avaje.ebeaninternal.server.core;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.avaje.ebean.SqlUpdate;
|
||||
import com.avaje.ebeaninternal.api.SpiEbeanServer;
|
||||
import com.avaje.ebeaninternal.api.SpiSqlUpdate;
|
||||
@@ -13,107 +11,108 @@ import com.avaje.ebeaninternal.server.persist.PersistExecute;
|
||||
*/
|
||||
public final class PersistRequestUpdateSql extends PersistRequest {
|
||||
|
||||
public enum SqlType {
|
||||
SQL_UPDATE, SQL_DELETE, SQL_INSERT, SQL_UNKNOWN
|
||||
}
|
||||
public enum SqlType {
|
||||
SQL_UPDATE, SQL_DELETE, SQL_INSERT, SQL_UNKNOWN
|
||||
}
|
||||
|
||||
private final SpiSqlUpdate updateSql;
|
||||
private final SpiSqlUpdate updateSql;
|
||||
|
||||
private int rowCount;
|
||||
private int rowCount;
|
||||
|
||||
private String bindLog;
|
||||
private String bindLog;
|
||||
|
||||
private SqlType sqlType;
|
||||
private SqlType sqlType;
|
||||
|
||||
private String tableName;
|
||||
private String tableName;
|
||||
|
||||
private String description;
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* Create.
|
||||
*/
|
||||
public PersistRequestUpdateSql(SpiEbeanServer server, SqlUpdate updateSql,
|
||||
SpiTransaction t, PersistExecute persistExecute) {
|
||||
super(server, t, persistExecute);
|
||||
this.type = Type.UPDATESQL;
|
||||
this.updateSql = (SpiSqlUpdate)updateSql;
|
||||
}
|
||||
/**
|
||||
* Create.
|
||||
*/
|
||||
public PersistRequestUpdateSql(SpiEbeanServer server, SqlUpdate updateSql,
|
||||
SpiTransaction t, PersistExecute persistExecute) {
|
||||
|
||||
@Override
|
||||
public int executeNow() {
|
||||
return persistExecute.executeSqlUpdate(this);
|
||||
}
|
||||
super(server, t, persistExecute);
|
||||
this.type = Type.UPDATESQL;
|
||||
this.updateSql = (SpiSqlUpdate) updateSql;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int executeOrQueue() {
|
||||
return executeStatement();
|
||||
}
|
||||
@Override
|
||||
public int executeNow() {
|
||||
return persistExecute.executeSqlUpdate(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the UpdateSql.
|
||||
*/
|
||||
public SpiSqlUpdate getUpdateSql() {
|
||||
return updateSql;
|
||||
}
|
||||
@Override
|
||||
public int executeOrQueue() {
|
||||
return executeStatement();
|
||||
}
|
||||
|
||||
/**
|
||||
* No concurrency checking so just note the rowCount.
|
||||
*/
|
||||
public void checkRowCount(int count) throws SQLException {
|
||||
this.rowCount = count;
|
||||
}
|
||||
/**
|
||||
* Return the UpdateSql.
|
||||
*/
|
||||
public SpiSqlUpdate getUpdateSql() {
|
||||
return updateSql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not called for this type of request.
|
||||
*/
|
||||
public void setGeneratedKey(Object idValue) {
|
||||
}
|
||||
/**
|
||||
* No concurrency checking so just note the rowCount.
|
||||
*/
|
||||
public void checkRowCount(int count) {
|
||||
this.rowCount = count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the type of statement executed. Used to automatically register
|
||||
* with the transaction event.
|
||||
*/
|
||||
public void setType(SqlType sqlType, String tableName, String description) {
|
||||
this.sqlType = sqlType;
|
||||
this.tableName = tableName;
|
||||
this.description = description;
|
||||
}
|
||||
/**
|
||||
* Not called for this type of request.
|
||||
*/
|
||||
public void setGeneratedKey(Object idValue) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the bound values.
|
||||
*/
|
||||
public void setBindLog(String bindLog) {
|
||||
this.bindLog = bindLog;
|
||||
}
|
||||
/**
|
||||
* Specify the type of statement executed. Used to automatically register
|
||||
* with the transaction event.
|
||||
*/
|
||||
public void setType(SqlType sqlType, String tableName, String description) {
|
||||
this.sqlType = sqlType;
|
||||
this.tableName = tableName;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform post execute processing.
|
||||
*/
|
||||
public void postExecute() throws SQLException {
|
||||
/**
|
||||
* Set the bound values.
|
||||
*/
|
||||
public void setBindLog(String bindLog) {
|
||||
this.bindLog = bindLog;
|
||||
}
|
||||
|
||||
if (transaction.isLogSummary()) {
|
||||
String m = description + " table[" + tableName + "] rows["+ rowCount + "] bind[" + bindLog + "]";
|
||||
transaction.logSummary(m);
|
||||
}
|
||||
/**
|
||||
* Perform post execute processing.
|
||||
*/
|
||||
public void postExecute() {
|
||||
|
||||
if (updateSql.isAutoTableMod()) {
|
||||
// add the modification info to the TransactionEvent
|
||||
// this is used to invalidate cached objects etc
|
||||
switch (sqlType) {
|
||||
case SQL_INSERT:
|
||||
transaction.getEvent().add(tableName, true, false, false);
|
||||
break;
|
||||
case SQL_UPDATE:
|
||||
transaction.getEvent().add(tableName, false, true, false);
|
||||
break;
|
||||
case SQL_DELETE:
|
||||
transaction.getEvent().add(tableName, false, false, true);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (transaction.isLogSummary()) {
|
||||
String m = description + " table[" + tableName + "] rows[" + rowCount + "] bind[" + bindLog + "]";
|
||||
transaction.logSummary(m);
|
||||
}
|
||||
|
||||
if (updateSql.isAutoTableMod()) {
|
||||
// add the modification info to the TransactionEvent
|
||||
// this is used to invalidate cached objects etc
|
||||
switch (sqlType) {
|
||||
case SQL_INSERT:
|
||||
transaction.getEvent().add(tableName, true, false, false);
|
||||
break;
|
||||
case SQL_UPDATE:
|
||||
transaction.getEvent().add(tableName, false, true, false);
|
||||
break;
|
||||
case SQL_DELETE:
|
||||
transaction.getEvent().add(tableName, false, false, true);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public interface BatchPostExecute {
|
||||
* Check that the rowCount is correct for this execute. This is for
|
||||
* performing concurrency checking in batch execution.
|
||||
*/
|
||||
void checkRowCount(int rowCount) throws SQLException;
|
||||
void checkRowCount(int rowCount);
|
||||
|
||||
/**
|
||||
* For inserts with generated keys. Otherwise not used.
|
||||
@@ -30,6 +30,6 @@ public interface BatchPostExecute {
|
||||
* and for beans resetting their 'loaded' status.
|
||||
* </p>
|
||||
*/
|
||||
void postExecute() throws SQLException;
|
||||
void postExecute();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user