public final class DefaultOrmUpdate<T> extends Object implements SpiUpdate<T>, Serializable
SpiUpdate.OrmUpdateType| Constructor and Description |
|---|
DefaultOrmUpdate(Class<?> beanType,
EbeanServer server,
String baseTable,
DeployNamedUpdate namedUpdate) |
DefaultOrmUpdate(Class<?> beanType,
EbeanServer server,
String baseTable,
String updateStatement)
Create with a specific server.
|
| Modifier and Type | Method and Description |
|---|---|
int |
execute()
Execute the statement returning the number of rows modified.
|
String |
getBaseTable()
Return the name of the table being modified.
|
Class<?> |
getBeanType()
Return the type of bean being updated.
|
BindParams |
getBindParams()
Return the bind parameters.
|
String |
getGeneratedSql()
Return the sql that is actually executed.
|
String |
getName()
Return the name if it is a named update.
|
SpiUpdate.OrmUpdateType |
getOrmUpdateType()
Return the type of this - insert, update or delete.
|
int |
getTimeout()
Return the timeout in seconds.
|
String |
getUpdateStatement()
Return the update statement.
|
boolean |
isNotifyCache()
Return true if the cache should be notified so that invalidates
appropriate objects.
|
DefaultOrmUpdate<T> |
set(int position,
Object value)
Set an ordered bind parameter.
|
DefaultOrmUpdate<T> |
set(String name,
Object value)
Set a named parameter.
|
void |
setGeneratedSql(String generatedSql)
Set the generated sql used.
|
DefaultOrmUpdate<T> |
setNotifyCache(boolean notifyCache)
Set this to false if you don't want eBean to automatically deduce the
table modification information and process it.
|
DefaultOrmUpdate<T> |
setNull(int position,
int jdbcType)
Set an ordered parameter that is null.
|
DefaultOrmUpdate<T> |
setNull(String name,
int jdbcType)
Set a named parameter that is null.
|
DefaultOrmUpdate<T> |
setNullParameter(int position,
int jdbcType)
Set an ordered parameter that is null (same as bind).
|
DefaultOrmUpdate<T> |
setNullParameter(String name,
int jdbcType)
Bind a named parameter that is null (same as bind).
|
DefaultOrmUpdate<T> |
setParameter(int position,
Object value)
Set and ordered bind parameter (same as bind).
|
DefaultOrmUpdate<T> |
setParameter(String name,
Object param)
Bind a named parameter (same as bind).
|
DefaultOrmUpdate<T> |
setTimeout(int secs)
Set a timeout for statement execution.
|
public DefaultOrmUpdate(Class<?> beanType, EbeanServer server, String baseTable, String updateStatement)
public DefaultOrmUpdate(Class<?> beanType, EbeanServer server, String baseTable, DeployNamedUpdate namedUpdate)
public DefaultOrmUpdate<T> setTimeout(int secs)
UpdateThis will typically result in a call to setQueryTimeout() on a preparedStatement. If the timeout occurs an exception will be thrown - this will be a SQLException wrapped up in a PersistenceException.
setTimeout in interface Update<T>secs - the timeout in seconds. Zero implies unlimited.public Class<?> getBeanType()
SpiUpdategetBeanType in interface SpiUpdate<T>public int getTimeout()
getTimeout in interface SpiUpdate<T>public int execute()
Updatepublic DefaultOrmUpdate<T> setNotifyCache(boolean notifyCache)
Set this to false if you don't want any cache invalidation or text index management to occur. You may do this when say you update only one column and you know that it is not important for cached objects or text indexes.
setNotifyCache in interface Update<T>public boolean isNotifyCache()
isNotifyCache in interface SpiUpdate<T>public String getName()
Updatepublic String getUpdateStatement()
SpiUpdategetUpdateStatement in interface SpiUpdate<T>public DefaultOrmUpdate<T> set(int position, Object value)
Updateposition starts at value 1 (not 0) to be consistent with PreparedStatement.
Set a value for each ? you have in the sql.
public DefaultOrmUpdate<T> setParameter(int position, Object value)
UpdatesetParameter in interface Update<T>position - the index position of the parameter starting with 1.value - the parameter value to bind.public DefaultOrmUpdate<T> setNull(int position, int jdbcType)
Updateposition starts at value 1 (not 0) to be consistent with PreparedStatement.
public DefaultOrmUpdate<T> setNullParameter(int position, int jdbcType)
UpdatesetNullParameter in interface Update<T>public DefaultOrmUpdate<T> set(String name, Object value)
UpdateA more succinct version of setParameter() to be consistent with Query.
public DefaultOrmUpdate<T> setParameter(String name, Object param)
UpdatesetParameter in interface Update<T>public DefaultOrmUpdate<T> setNull(String name, int jdbcType)
UpdateA more succinct version of setNullParameter().
public DefaultOrmUpdate<T> setNullParameter(String name, int jdbcType)
UpdatesetNullParameter in interface Update<T>public BindParams getBindParams()
getBindParams in interface SpiUpdate<T>public String getGeneratedSql()
UpdategetGeneratedSql in interface Update<T>public void setGeneratedSql(String generatedSql)
SpiUpdatesetGeneratedSql in interface SpiUpdate<T>public String getBaseTable()
SpiUpdategetBaseTable in interface SpiUpdate<T>public SpiUpdate.OrmUpdateType getOrmUpdateType()
SpiUpdategetOrmUpdateType in interface SpiUpdate<T>Copyright © 2014. All Rights Reserved.