|
Liferay 6.0.5 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.liferay.portal.service.persistence.BatchSessionImpl
public class BatchSessionImpl
Constructor Summary | |
---|---|
BatchSessionImpl()
|
Method Summary | |
---|---|
boolean |
isEnabled()
Determines if update batching is enabled |
void |
setEnabled(boolean enabled)
Sets whether update batching is enabled. |
void |
update(Session session,
BaseModel<?> model,
boolean merge)
Updates the model instance in the database or adds it if it does not yet exist, and possibly flushes the session. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BatchSessionImpl()
Method Detail |
---|
public boolean isEnabled()
BatchSession
isEnabled
in interface BatchSession
true
if update batching is enabled;
false
otherwisepublic void setEnabled(boolean enabled)
BatchSession
setEnabled
in interface BatchSession
enabled
- whether update batching is enabled.public void update(Session session, BaseModel<?> model, boolean merge) throws ORMException
BatchSession
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.model.User)
for an example.
update
in interface BatchSession
session
- the session to perform the update onmodel
- the model instance to updatemerge
- whether to merge the model instance with the current
session
ORMException
- if a database exception occurred
|
Liferay 6.0.5 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |