com.liferay.portal.service.persistence
Interface BasePersistence<T extends BaseModel<T>>
- All Known Subinterfaces:
- AccountPersistence, AddressPersistence, AnnouncementsDeliveryPersistence, AnnouncementsEntryPersistence, AnnouncementsFlagPersistence, AssetCategoryPersistence, AssetCategoryPropertyPersistence, AssetEntryPersistence, AssetLinkPersistence, AssetTagPersistence, AssetTagPropertyPersistence, AssetTagStatsPersistence, AssetVocabularyPersistence, BackgroundTaskPersistence, BlogsEntryPersistence, BlogsStatsUserPersistence, BookmarksEntryPersistence, BookmarksFolderPersistence, BrowserTrackerPersistence, CalEventPersistence, ClassNamePersistence, ClusterGroupPersistence, CompanyPersistence, ContactPersistence, CounterPersistence, CountryPersistence, CyrusUserPersistence, CyrusVirtualPersistence, DDLRecordPersistence, DDLRecordSetPersistence, DDLRecordVersionPersistence, DDMContentPersistence, DDMStorageLinkPersistence, DDMStructureLinkPersistence, DDMStructurePersistence, DDMTemplatePersistence, DLContentPersistence, DLFileEntryMetadataPersistence, DLFileEntryPersistence, DLFileEntryTypePersistence, DLFileRankPersistence, DLFileShortcutPersistence, DLFileVersionPersistence, DLFolderPersistence, DLSyncEventPersistence, EmailAddressPersistence, ExpandoColumnPersistence, ExpandoRowPersistence, ExpandoTablePersistence, ExpandoValuePersistence, GroupPersistence, ImagePersistence, JournalArticleImagePersistence, JournalArticlePersistence, JournalArticleResourcePersistence, JournalContentSearchPersistence, JournalFeedPersistence, JournalFolderPersistence, LayoutBranchPersistence, LayoutFriendlyURLPersistence, LayoutPersistence, LayoutPrototypePersistence, LayoutRevisionPersistence, LayoutSetBranchPersistence, LayoutSetPersistence, LayoutSetPrototypePersistence, ListTypePersistence, LockPersistence, MBBanPersistence, MBCategoryPersistence, MBDiscussionPersistence, MBMailingListPersistence, MBMessagePersistence, MBStatsUserPersistence, MBThreadFlagPersistence, MBThreadPersistence, MDRActionPersistence, MDRRuleGroupInstancePersistence, MDRRuleGroupPersistence, MDRRulePersistence, MembershipRequestPersistence, OrganizationPersistence, OrgGroupRolePersistence, OrgLaborPersistence, PasswordPolicyPersistence, PasswordPolicyRelPersistence, PasswordTrackerPersistence, PhonePersistence, PluginSettingPersistence, PollsChoicePersistence, PollsQuestionPersistence, PollsVotePersistence, PortalPreferencesPersistence, PortletItemPersistence, PortletPersistence, PortletPreferencesPersistence, RatingsEntryPersistence, RatingsStatsPersistence, RegionPersistence, ReleasePersistence, RepositoryEntryPersistence, RepositoryPersistence, ResourceActionPersistence, ResourceBlockPermissionPersistence, ResourceBlockPersistence, ResourcePermissionPersistence, ResourceTypePermissionPersistence, RolePersistence, SCFrameworkVersionPersistence, SCLicensePersistence, SCProductEntryPersistence, SCProductScreenshotPersistence, SCProductVersionPersistence, ServiceComponentPersistence, ShardPersistence, ShoppingCartPersistence, ShoppingCategoryPersistence, ShoppingCouponPersistence, ShoppingItemFieldPersistence, ShoppingItemPersistence, ShoppingItemPricePersistence, ShoppingOrderItemPersistence, ShoppingOrderPersistence, SocialActivityAchievementPersistence, SocialActivityCounterPersistence, SocialActivityLimitPersistence, SocialActivityPersistence, SocialActivitySetPersistence, SocialActivitySettingPersistence, SocialRelationPersistence, SocialRequestPersistence, SubscriptionPersistence, SystemEventPersistence, TeamPersistence, TicketPersistence, TrashEntryPersistence, TrashVersionPersistence, UserGroupGroupRolePersistence, UserGroupPersistence, UserGroupRolePersistence, UserIdMapperPersistence, UserNotificationDeliveryPersistence, UserNotificationEventPersistence, UserPersistence, UserTrackerPathPersistence, UserTrackerPersistence, VirtualHostPersistence, WebDAVPropsPersistence, WebsitePersistence, WikiNodePersistence, WikiPagePersistence, WikiPageResourcePersistence, WorkflowDefinitionLinkPersistence, WorkflowInstanceLinkPersistence
- All Known Implementing Classes:
- AccountPersistenceImpl, AddressPersistenceImpl, AddressPersistenceImpl2, AnnouncementsDeliveryPersistenceImpl, AnnouncementsEntryFinderImpl, AnnouncementsEntryPersistenceImpl, AnnouncementsFlagPersistenceImpl, AssetCategoryFinderImpl, AssetCategoryPersistenceImpl, AssetCategoryPropertyFinderImpl, AssetCategoryPropertyPersistenceImpl, AssetEntryFinderImpl, AssetEntryPersistenceImpl, AssetLinkPersistenceImpl, AssetTagFinderImpl, AssetTagPersistenceImpl, AssetTagPropertyFinderImpl, AssetTagPropertyKeyFinderImpl, AssetTagPropertyPersistenceImpl, AssetTagStatsPersistenceImpl, AssetVocabularyFinderImpl, AssetVocabularyPersistenceImpl, BackgroundTaskPersistenceImpl, BasePersistenceImpl, BlogsEntryFinderImpl, BlogsEntryPersistenceImpl, BlogsStatsUserFinderImpl, BlogsStatsUserPersistenceImpl, BookmarksEntryFinderImpl, BookmarksEntryPersistenceImpl, BookmarksFolderFinderImpl, BookmarksFolderPersistenceImpl, BrowserTrackerPersistenceImpl, CalEventFinderImpl, CalEventPersistenceImpl, ClassNamePersistenceImpl, ClusterGroupPersistenceImpl, CompanyPersistenceImpl, ContactPersistenceImpl, CounterFinderImpl, CounterPersistenceImpl, CountryPersistenceImpl, CyrusUserPersistenceImpl, CyrusVirtualPersistenceImpl, DDLRecordFinderImpl, DDLRecordPersistenceImpl, DDLRecordSetFinderImpl, DDLRecordSetPersistenceImpl, DDLRecordVersionPersistenceImpl, DDMContentPersistenceImpl, DDMStorageLinkPersistenceImpl, DDMStructureFinderImpl, DDMStructureLinkPersistenceImpl, DDMStructurePersistenceImpl, DDMTemplateFinderImpl, DDMTemplatePersistenceImpl, DLContentPersistenceImpl, DLFileEntryFinderImpl, DLFileEntryMetadataPersistenceImpl, DLFileEntryPersistenceImpl, DLFileEntryTypeFinderImpl, DLFileEntryTypePersistenceImpl, DLFileRankFinderImpl, DLFileRankPersistenceImpl, DLFileShortcutPersistenceImpl, DLFileVersionPersistenceImpl, DLFolderFinderImpl, DLFolderPersistenceImpl, DLSyncEventPersistenceImpl, EmailAddressPersistenceImpl, ExpandoColumnPersistenceImpl, ExpandoRowPersistenceImpl, ExpandoTablePersistenceImpl, ExpandoValuePersistenceImpl, GroupFinderImpl, GroupPersistenceImpl, ImagePersistenceImpl, JournalArticleFinderImpl, JournalArticleImagePersistenceImpl, JournalArticlePersistenceImpl, JournalArticleResourcePersistenceImpl, JournalContentSearchPersistenceImpl, JournalFeedFinderImpl, JournalFeedPersistenceImpl, JournalFolderFinderImpl, JournalFolderPersistenceImpl, LayoutBranchPersistenceImpl, LayoutFinderImpl, LayoutFriendlyURLPersistenceImpl, LayoutPersistenceImpl, LayoutPrototypePersistenceImpl, LayoutRevisionPersistenceImpl, LayoutSetBranchPersistenceImpl, LayoutSetPersistenceImpl, LayoutSetPrototypePersistenceImpl, ListTypePersistenceImpl, LockFinderImpl, LockPersistenceImpl, MBBanPersistenceImpl, MBCategoryFinderImpl, MBCategoryPersistenceImpl, MBDiscussionPersistenceImpl, MBMailingListPersistenceImpl, MBMessageFinderImpl, MBMessagePersistenceImpl, MBStatsUserPersistenceImpl, MBThreadFinderImpl, MBThreadFlagPersistenceImpl, MBThreadPersistenceImpl, MDRActionPersistenceImpl, MDRRuleGroupFinderImpl, MDRRuleGroupInstancePersistenceImpl, MDRRuleGroupPersistenceImpl, MDRRulePersistenceImpl, MembershipRequestPersistenceImpl, OrganizationFinderImpl, OrganizationPersistenceImpl, OrgGroupRolePersistenceImpl, OrgLaborPersistenceImpl, PasswordPolicyFinderImpl, PasswordPolicyPersistenceImpl, PasswordPolicyRelPersistenceImpl, PasswordTrackerPersistenceImpl, PhonePersistenceImpl, PluginSettingPersistenceImpl, PollsChoicePersistenceImpl, PollsQuestionPersistenceImpl, PollsVotePersistenceImpl, PortalPreferencesPersistenceImpl, PortletItemPersistenceImpl, PortletPersistenceImpl, PortletPreferencesFinderImpl, PortletPreferencesPersistenceImpl, RatingsEntryFinderImpl, RatingsEntryPersistenceImpl, RatingsStatsFinderImpl, RatingsStatsPersistenceImpl, RegionPersistenceImpl, ReleasePersistenceImpl, RepositoryEntryPersistenceImpl, RepositoryPersistenceImpl, ResourceActionPersistenceImpl, ResourceBlockFinderImpl, ResourceBlockPermissionPersistenceImpl, ResourceBlockPersistenceImpl, ResourcePermissionFinderImpl, ResourcePermissionPersistenceImpl, ResourceTypePermissionFinderImpl, ResourceTypePermissionPersistenceImpl, RoleFinderImpl, RolePersistenceImpl, SCFrameworkVersionPersistenceImpl, SCLicensePersistenceImpl, SCProductEntryPersistenceImpl, SCProductScreenshotPersistenceImpl, SCProductVersionPersistenceImpl, ServiceComponentPersistenceImpl, ShardPersistenceImpl, ShoppingCartPersistenceImpl, ShoppingCategoryPersistenceImpl, ShoppingCouponFinderImpl, ShoppingCouponPersistenceImpl, ShoppingItemFieldPersistenceImpl, ShoppingItemFinderImpl, ShoppingItemPersistenceImpl, ShoppingItemPricePersistenceImpl, ShoppingOrderFinderImpl, ShoppingOrderItemPersistenceImpl, ShoppingOrderPersistenceImpl, SocialActivityAchievementPersistenceImpl, SocialActivityCounterFinderImpl, SocialActivityCounterPersistenceImpl, SocialActivityFinderImpl, SocialActivityLimitPersistenceImpl, SocialActivityPersistenceImpl, SocialActivitySetFinderImpl, SocialActivitySetPersistenceImpl, SocialActivitySettingPersistenceImpl, SocialRelationPersistenceImpl, SocialRequestPersistenceImpl, SubscriptionPersistenceImpl, SystemEventPersistenceImpl, TeamFinderImpl, TeamPersistenceImpl, TicketPersistenceImpl, TrashEntryPersistenceImpl, TrashVersionPersistenceImpl, UserFinderImpl, UserGroupFinderImpl, UserGroupGroupRolePersistenceImpl, UserGroupPersistenceImpl, UserGroupRoleFinderImpl, UserGroupRolePersistenceImpl, UserIdMapperPersistenceImpl, UserNotificationDeliveryPersistenceImpl, UserNotificationEventPersistenceImpl, UserPersistenceImpl, UserTrackerPathPersistenceImpl, UserTrackerPersistenceImpl, VirtualHostPersistenceImpl, WebDAVPropsPersistenceImpl, WebsitePersistenceImpl, WikiNodePersistenceImpl, WikiPageFinderImpl, WikiPagePersistenceImpl, WikiPageResourcePersistenceImpl, WorkflowDefinitionLinkPersistenceImpl, WorkflowInstanceLinkPersistenceImpl
public interface BasePersistence<T extends BaseModel<T>>
The base interface for all ServiceBuilder persistence classes. This interface
should never need to be used directly.
Caching information and settings can be found in
portal.properties
- See Also:
BasePersistenceImpl
Method Summary |
void |
clearCache()
Clears the cache for all instances of this model. |
void |
clearCache(List<T> modelList)
Clears the cache for a List instances of this model. |
void |
clearCache(T model)
Clears the cache for one instance of this model. |
void |
closeSession(Session session)
|
long |
countWithDynamicQuery(DynamicQuery dynamicQuery)
Returns the number of rows that match the dynamic query. |
long |
countWithDynamicQuery(DynamicQuery dynamicQuery,
Projection projection)
Returns the number of rows that match the dynamic query. |
T |
fetchByPrimaryKey(Serializable primaryKey)
Returns the model instance with the primary key or returns
null if it could not be found. |
T |
findByPrimaryKey(Serializable primaryKey)
Returns the model instance with the primary key or throws a NoSuchModelException 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)
Performs a dynamic query on the database and returns an ordered range of
the matching rows. |
void |
flush()
|
Session |
getCurrentSession()
|
DataSource |
getDataSource()
Returns the data source for this model. |
ModelListener<T>[] |
getListeners()
Returns the listeners registered for this model. |
Class<T> |
getModelClass()
|
Session |
openSession()
|
SystemException |
processException(Exception e)
|
void |
registerListener(ModelListener<T> listener)
Registers a new listener for this model. |
T |
remove(Serializable primaryKey)
Removes the model instance with the primary key from the database. |
T |
remove(T model)
Removes the model instance from the database. |
void |
setDataSource(DataSource dataSource)
Sets the data source for this model. |
void |
unregisterListener(ModelListener<T> listener)
Unregisters the model listener. |
T |
update(T model)
Updates the model instance in the database or adds it if it does not yet
exist. |
T |
update(T model,
boolean merge)
Deprecated. As of 6.2.0, replaced by update(BaseModel) } |
T |
update(T model,
boolean merge,
ServiceContext serviceContext)
Deprecated. As of 6.2.0, replaced by update(BaseModel,
ServiceContext) } |
T |
update(T model,
ServiceContext serviceContext)
Updates the model instance in the database or adds it if it does not yet
exist, within a different service context. |
clearCache
void clearCache()
- Clears the cache for all instances of this model.
The EntityCache
and FinderCache
are both cleared by this
method.
clearCache
void clearCache(List<T> modelList)
- Clears the cache for a List instances of this model.
The EntityCache
and FinderCache
are both cleared by this
method.
- Parameters:
modelList
- the List instances of this model to clear the cache for
clearCache
void clearCache(T model)
- Clears the cache for one instance of this model.
The EntityCache
and FinderCache
are both cleared by this
method.
- Parameters:
model
- the instance of this model to clear the cache for
closeSession
void closeSession(Session session)
countWithDynamicQuery
long countWithDynamicQuery(DynamicQuery dynamicQuery)
throws SystemException
- Returns the number of rows that match the dynamic query.
- Parameters:
dynamicQuery
- the dynamic query
- Returns:
- the number of rows that match the dynamic query
- Throws:
SystemException
- if a system exception occurred
countWithDynamicQuery
long countWithDynamicQuery(DynamicQuery dynamicQuery,
Projection projection)
throws SystemException
- Returns the number of rows that match the dynamic query.
- Parameters:
dynamicQuery
- the dynamic queryprojection
- the projection to apply to the query
- Returns:
- the number of rows that match the dynamic query
- Throws:
SystemException
- if a system exception occurred
fetchByPrimaryKey
T fetchByPrimaryKey(Serializable primaryKey)
throws SystemException
- Returns the model instance with the primary key or returns
null
if it could not be found.
- Parameters:
primaryKey
- the primary key of the model instance
- Returns:
- the model instance, or
null
if an instance of this
model with the primary key could not be found
- Throws:
SystemException
- if the primary key is null
, or if a
system exception occurred
findByPrimaryKey
T findByPrimaryKey(Serializable primaryKey)
throws NoSuchModelException,
SystemException
- Returns the model instance with the primary key or throws a
NoSuchModelException
if it could not be found.
- Parameters:
primaryKey
- the primary key of the model instance
- Returns:
- the model instance
- Throws:
NoSuchModelException
- if an instance of this model with the
primary key could not be found
SystemException
- if the primary key is null
, or if a
system exception occurred
findWithDynamicQuery
List findWithDynamicQuery(DynamicQuery dynamicQuery)
throws SystemException
- Performs a dynamic query on the database and returns the matching rows.
- Parameters:
dynamicQuery
- the dynamic query
- Returns:
- the matching rows
- Throws:
SystemException
- if a system exception occurred
findWithDynamicQuery
List findWithDynamicQuery(DynamicQuery dynamicQuery,
int start,
int end)
throws SystemException
- Performs a dynamic query on the database and returns a range of the
matching rows.
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.
- Parameters:
dynamicQuery
- the dynamic querystart
- the lower bound of the range of matching rowsend
- the upper bound of the range of matching rows (not inclusive)
- Returns:
- the range of matching rows
- Throws:
SystemException
- if a system exception occurred- See Also:
QueryUtil.list(
com.liferay.portal.kernel.dao.orm.Query,
com.liferay.portal.kernel.dao.orm.Dialect, int, int)
findWithDynamicQuery
List findWithDynamicQuery(DynamicQuery dynamicQuery,
int start,
int end,
OrderByComparator orderByComparator)
throws SystemException
- Performs a dynamic query on the database and returns an ordered range of
the matching rows.
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.
- Parameters:
dynamicQuery
- the dynamic querystart
- the lower bound of the range of matching rowsend
- the upper bound of the range of matching rows (not inclusive)orderByComparator
- the comparator to order the results by
(optionally null
)
- Returns:
- the ordered range of matching rows
- Throws:
SystemException
- if a system exception occurred
flush
void flush()
throws SystemException
- Throws:
SystemException
getCurrentSession
Session getCurrentSession()
throws ORMException
- Throws:
ORMException
getDataSource
DataSource getDataSource()
- Returns the data source for this model.
- Returns:
- the data source for this model
- See Also:
setDataSource(DataSource)
getListeners
ModelListener<T>[] getListeners()
- Returns the listeners registered for this model.
- Returns:
- the listeners registered for this model
- See Also:
registerListener(ModelListener)
getModelClass
Class<T> getModelClass()
openSession
Session openSession()
throws ORMException
- Throws:
ORMException
processException
SystemException processException(Exception e)
registerListener
void registerListener(ModelListener<T> listener)
- Registers a new listener for this model.
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.
- Parameters:
listener
- the model listener to register
remove
T remove(Serializable primaryKey)
throws NoSuchModelException,
SystemException
- Removes the model instance with the primary key from the database. Also
notifies the appropriate model listeners.
- Parameters:
primaryKey
- the primary key of the model instance to remove
- Returns:
- the model instance that was removed
- Throws:
NoSuchModelException
- if an instance of this model with the
primary key could not be found
SystemException
- if a system exception occurred
remove
T remove(T model)
throws SystemException
- Removes the model instance from the database. Also notifies the
appropriate model listeners.
- Parameters:
model
- the model instance to remove
- Returns:
- the model instance that was removed
- Throws:
SystemException
- if a system exception occurred
setDataSource
void setDataSource(DataSource dataSource)
- Sets the data source for this model.
- Parameters:
dataSource
- the data source to use for this model
unregisterListener
void unregisterListener(ModelListener<T> listener)
- Unregisters the model listener.
- Parameters:
listener
- the model listener to unregister- See Also:
registerListener(ModelListener)
update
T update(T model)
throws SystemException
- Updates the model instance in the database or adds it if it does not yet
exist. Also notifies the appropriate model listeners.
Typically not called directly, use local service update model methods
instead. For example, UserLocalServiceUtil.updateUser(
com.liferay.portal.model.User)
.
- Parameters:
model
- the model instance to update
- Returns:
- the model instance that was updated
- Throws:
SystemException
- if a system exception occurred
update
T update(T model,
boolean merge)
throws SystemException
- Deprecated. As of 6.2.0, replaced by
update(BaseModel)
}
- Throws:
SystemException
update
T update(T model,
boolean merge,
ServiceContext serviceContext)
throws SystemException
- Deprecated. As of 6.2.0, replaced by
update(BaseModel,
ServiceContext)
}
- Throws:
SystemException
update
T update(T model,
ServiceContext serviceContext)
throws SystemException
- Updates the model instance in the database or adds it if it does not yet
exist, within a different service context. Also notifies the appropriate
model listeners.
- Parameters:
model
- the model instance to updateserviceContext
- the service context to be applied
- Returns:
- the model instance that was updated
- Throws:
SystemException
- if a system exception occurred