@Deprecated
public interface BatchSession
Although all database updates ultimately pass through this class, its
batching functionality is only used for large sets of contiguous updates. For
usage examples see LayoutLocalServiceImpl.importLayouts(long,
long, boolean, java.util.Map, java.io.File)
, and VerifyProcessUtil.verifyProcess(boolean, boolean,
boolean)
.
Modifier and Type | Method and Description |
---|---|
void |
delete(Session session,
BaseModel<?> model)
Deprecated.
Deletes the model instance in the database, and possibly flushes the
session.
|
boolean |
isEnabled()
Deprecated.
Returns
true if update batching is enabled |
void |
setEnabled(boolean enabled)
Deprecated.
Sets whether update batching is enabled.
|
void |
update(Session session,
BaseModel<?> model,
boolean merge)
Deprecated.
Updates the model instance in the database or adds it if it does not yet
exist, and possibly flushes the session.
|
void delete(Session session, BaseModel<?> model) throws ORMException
The session will be flushed if one of the following is true
:
The batch size may be set in portal.properties with the key
hibernate.jdbc.batch_size
.
session
- the session to perform the update onmodel
- the model instance to updateORMException
boolean isEnabled()
true
if update batching is enabledtrue
if update batching is enabled;
false
otherwisevoid setEnabled(boolean enabled)
enabled
- whether update batching is enabled.void update(Session session, BaseModel<?> model, boolean merge) throws ORMException
The session will be flushed if one of the following is true
:
The batch size may be set in portal.properties with the key
hibernate.jdbc.batch_size
.
The merge
parameter controls a special case of persistence.
If the session that a model instance was originally loaded from is
closed, that instance becomes "detached", and changes to it
will not be persisted automatically. To persist its changes, the detached
instance must be merged with the current session. This will load a new
copy of the model instance from the database, copy the changes to it, and
persist it.
This process is most commonly necessary if a model instance is modified
in the controller or view, as the database session is closed when control
leaves the model layer. However, local service update model methods use
merging by default, so in most cases this nuance is handled
automatically. See UserLocalService.updateUser(
com.liferay.portal.kernel.model.User)
for an example.
session
- the sessionmodel
- the model instancemerge
- whether to merge the model instance with the current sessionORMException