No effective change - code cleanup - removed unused param

This commit is contained in:
Robin Bygrave
2015-08-01 19:53:07 +12:00
parent 9769e4b574
commit 402ab092d8
6 changed files with 26 additions and 3 deletions
@@ -25,6 +25,7 @@ public class DeleteHandler extends DmlHandler {
/**
* Generate and bind the delete statement.
*/
@Override
public void bind() throws SQLException {
sql = meta.getSql(persistRequest);
@@ -44,11 +45,13 @@ public class DeleteHandler extends DmlHandler {
/**
* Execute the delete non-batch.
*/
@Override
public void execute() throws SQLException, OptimisticLockException {
int rowCount = dataBind.executeUpdate();
checkRowCount(rowCount);
}
@Override
public void registerDerivedRelationship(DerivedRelationshipData assocBean) {
throw new RuntimeException("Never called on delete");
}
@@ -63,6 +63,7 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
}
}
@Override
public PersistRequestBean<?> getPersistRequest() {
return persistRequest;
}
@@ -70,11 +71,13 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
/**
* Get the sql and bind the statement.
*/
@Override
public abstract void bind() throws SQLException;
/**
* Execute now for non-batch execution.
*/
@Override
public abstract void execute() throws SQLException;
/**
@@ -95,6 +98,7 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
/**
* Add this for batch execution.
*/
@Override
public void addBatch() throws SQLException {
PstmtBatch pstmtBatch = persistRequest.getPstmtBatch();
if (pstmtBatch != null) {
@@ -107,6 +111,7 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
/**
* Close the underlying statement.
*/
@Override
public void close() {
try {
if (dataBind != null) {
@@ -120,6 +125,7 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
/**
* Return the bind log.
*/
@Override
public String getBindLog() {
return bindLog == null ? "" : bindLog.toString();
}
@@ -128,6 +134,7 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
* Set the Id value that was bound. This value is used for logging summary
* level information.
*/
@Override
public void setIdValue(Object idValue) {
persistRequest.setBoundId(idValue);
}
@@ -147,7 +154,8 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
/**
* Bind a raw value. Used to bind the discriminator column.
*/
public void bind(String propName, Object value, int sqlType) throws SQLException {
@Override
public void bind(Object value, int sqlType) throws SQLException {
if (logLevelSql) {
if (value == null) {
bindLog.append("null");
@@ -164,6 +172,7 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
dataBind.setObject(value, sqlType);
}
@Override
public void bindNoLog(Object value, int sqlType, String logPlaceHolder) throws SQLException {
if (logLevelSql) {
bindLog.append(logPlaceHolder).append(" ");
@@ -174,6 +183,7 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
/**
* Bind the value to the preparedStatement.
*/
@Override
public void bind(Object value, BeanProperty prop) throws SQLException {
bindInternal(logLevelSql, value, prop);
}
@@ -181,6 +191,7 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
/**
* Bind the value to the preparedStatement without logging.
*/
@Override
public void bindNoLog(Object value, BeanProperty prop) throws SQLException {
bindInternal(false, value, prop);
}
@@ -212,6 +223,7 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
* generation.
* </p>
*/
@Override
public void registerUpdateGenValue(BeanProperty prop, EntityBean bean, Object value) {
if (updateGenValues == null) {
updateGenValues = new ArrayList<UpdateGenValue>();
@@ -61,6 +61,7 @@ public class InsertHandler extends DmlHandler {
/**
* Generate and bind the insert statement.
*/
@Override
public void bind() throws SQLException {
BeanDescriptor<?> desc = persistRequest.getBeanDescriptor();
@@ -123,6 +124,7 @@ public class InsertHandler extends DmlHandler {
* Execute the insert in a normal non batch fashion. Additionally using
* getGeneratedKeys if required.
*/
@Override
public void execute() throws SQLException, OptimisticLockException {
int rc = dataBind.executeUpdate();
if (useGeneratedKeys) {
@@ -225,6 +227,7 @@ public class InsertHandler extends DmlHandler {
}
}
@Override
public void registerDerivedRelationship(DerivedRelationshipData derivedRelationship) {
persistRequest.getTransaction().registerDerivedRelationship(derivedRelationship);
}
@@ -27,6 +27,7 @@ public class UpdateHandler extends DmlHandler {
/**
* Generate and bind the update statement.
*/
@Override
public void bind() throws SQLException {
SpiUpdatePlan updatePlan = meta.getUpdatePlan(persistRequest);
@@ -73,6 +74,7 @@ public class UpdateHandler extends DmlHandler {
}
}
@Override
public void registerDerivedRelationship(DerivedRelationshipData derivedRelationship) {
persistRequest.getTransaction().registerDerivedRelationship(derivedRelationship);
}
@@ -29,17 +29,20 @@ public class BindableDiscriminator implements Bindable {
return columnName + " = " + discValue;
}
@Override
public void addToUpdate(PersistRequestBean<?> request, List<Bindable> list) {
throw new PersistenceException("Never called (only for inserts)");
}
@Override
public void dmlAppend(GenerateDmlRequest request) {
request.appendColumn(columnName);
}
@Override
public void dmlBind(BindableRequest bindRequest, EntityBean bean) throws SQLException {
bindRequest.bind(columnName, discValue, sqlType);
bindRequest.bind(discValue, sqlType);
}
}
@@ -32,7 +32,7 @@ public interface BindableRequest {
/**
* Bind a raw value. Used to bind the discriminator column.
*/
void bind(String propName, Object value, int sqlType) throws SQLException;
void bind(Object value, int sqlType) throws SQLException;
/**
* Bind a raw value with a placeHolder to put into the transaction log.