|
Liferay 6.0.3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface BasePersistence<T extends BaseModel<T>>
The base interface for all persistence classes.
BasePersistenceImpl| Method Summary | |
|---|---|
void |
clearCache()
Clears the cache for all instances of this model. |
void |
clearCache(T model)
Clears the cache for one instance of this model. |
long |
countWithDynamicQuery(DynamicQuery dynamicQuery)
Counts the number of rows that match the dynamic query. |
T |
fetchByPrimaryKey(Serializable primaryKey)
Finds an instance of this model by its primary key, or return null if it could not be found. |
T |
findByPrimaryKey(Serializable primaryKey)
Finds an instance of this model by its primary key, or throw an exception if it could not be found. |
List |
findWithDynamicQuery(DynamicQuery dynamicQuery)
Performs a dynamic query on the database and returns the matching rows. |
List |
findWithDynamicQuery(DynamicQuery dynamicQuery,
int start,
int end)
Performs a dynamic query on the database and returns a range of the matching rows. |
List |
findWithDynamicQuery(DynamicQuery dynamicQuery,
int start,
int end,
OrderByComparator orderByComparator)
Finds an ordered range of all the instances of this model that match the dynamic query. |
DataSource |
getDataSource()
Gets the data source for this model. |
ModelListener<T>[] |
getListeners()
Gets the listeners registered for this model. |
void |
registerListener(ModelListener<T> listener)
Registers a new listener for this model. |
T |
remove(Serializable primaryKey)
Removes the model instance identified by the primary key from the database, and notifies the appropriate model listeners. |
T |
remove(T model)
Removes the model instance from the database and notifies the appropriate model listeners. |
void |
setDataSource(DataSource dataSource)
Sets the data source for this model. |
void |
unregisterListener(ModelListener<T> listener)
Unregisters the model listener. |
T |
update(T model,
boolean merge)
Updates the model instance in the database or adds it if it does not yet exist. |
T |
update(T model,
boolean merge,
ServiceContext serviceContext)
Updates the model instance in the database or adds it if it does not yet exist, within a different service context. |
| Method Detail |
|---|
void clearCache()
The EntityCache and FinderCache are both cleared by this
method.
Caching information and settings can be found in
portal.properties
void clearCache(T model)
The EntityCache and FinderCache are both cleared by this
method.
model - the instance of this model to clear the cache for
long countWithDynamicQuery(DynamicQuery dynamicQuery)
throws SystemException
dynamicQuery - the dynamic query to search with
SystemException - if a system exception occurred
T fetchByPrimaryKey(Serializable primaryKey)
throws SystemException
null if it could not be found.
primaryKey - the primary key of the model instance to find
null if an instance of this
model with the primary key does not exist
SystemException - if the primary key is null, or if a
system exception occurred
T findByPrimaryKey(Serializable primaryKey)
throws NoSuchModelException,
SystemException
primaryKey - the primary key of the model instance to find
NoSuchModelException - if an instance of this model with the
primary key does not exist
SystemException - if the primary key is null, or if a
system exception occurred
List findWithDynamicQuery(DynamicQuery dynamicQuery)
throws SystemException
dynamicQuery - the dynamic query to search with
SystemException - if a system exception occurred
List findWithDynamicQuery(DynamicQuery dynamicQuery,
int start,
int end)
throws SystemException
Useful when paginating results. Returns a maximum of end -
start instances.
start and end are not primary keys, they are
indexes in the result set. Thus, 0 refers to the first
result in the set. Setting both start and end
to QueryUtil.ALL_POS will
return the full result set, functionally equivalent to findWithDynamicQuery(DynamicQuery).
dynamicQuery - the dynamic query to search withstart - the lower bound of the range of model instances to returnend - the upper bound of the range of model instances to return
(not inclusive)
SystemException - if a system exception occurredQueryUtil.list(
com.liferay.portal.kernel.dao.orm.Query,
com.liferay.portal.kernel.dao.orm.Dialect, int, int)
List findWithDynamicQuery(DynamicQuery dynamicQuery,
int start,
int end,
OrderByComparator orderByComparator)
throws SystemException
start and end are not primary keys, they are
indexes in the result set. Thus, 0 refers to the first
result in the set. Setting both start and end
to QueryUtil.ALL_POS will
return the full result set.
dynamicQuery - the dynamic query to search withstart - the lower bound of the range of model instances to returnend - the upper bound of the range of model instances to return
(not inclusive)orderByComparator - the comparator to order the results by
SystemException - if a system exception occurredDataSource getDataSource()
setDataSource(DataSource)ModelListener<T>[] getListeners()
registerListener(ModelListener)void registerListener(ModelListener<T> listener)
A model listener is notified whenever a change is made to an instance of this model, such as when one is added, updated, or removed.
listener - the model listener to register
T remove(Serializable primaryKey)
throws NoSuchModelException,
SystemException
primaryKey - the primary key of the model instance to remove
NoSuchModelException - if an instance of this model with the
primary key does not exist
SystemException - if a system exception occurred
T remove(T model)
throws SystemException
model - the model instance to remove
SystemException - if a system exception occurredvoid setDataSource(DataSource dataSource)
dataSource - the data source to use for this modelvoid unregisterListener(ModelListener<T> listener)
listener - the model listener to unregisterregisterListener(ModelListener)
T update(T model,
boolean merge)
throws SystemException
Typically not called directly, use local service update model methods
instead. For example, UserLocalServiceUtil.updateUser(com.liferay.portal.model.User).
model - the model instance to updatemerge - whether to merge the model instance with the current
session. See BatchSession.update(com.liferay.portal.kernel.dao.orm.Session,
BaseModel, boolean) for an explanation.
SystemException - if a system exception occurred
T update(T model,
boolean merge,
ServiceContext serviceContext)
throws SystemException
model - the model instance to updatemerge - whether to merge the model instance with the current
session. See BatchSession.update(com.liferay.portal.kernel.dao.orm.Session,
BaseModel, boolean) for an explanation.serviceContext - the service context to perform the update in
SystemException - if a system exception occurred
|
Liferay 6.0.3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||