com.liferay.portal.service.persistence.impl
Class BasePersistenceImpl<T extends BaseModel<T>>
java.lang.Object
com.liferay.portal.service.persistence.impl.BasePersistenceImpl<T>
- All Implemented Interfaces:
- com.liferay.portal.kernel.dao.orm.SessionFactory, BasePersistence<T>
public class BasePersistenceImpl<T extends BaseModel<T>>
- extends java.lang.Object
- implements BasePersistence<T>, com.liferay.portal.kernel.dao.orm.SessionFactory
View Source
- Author:
- Brian Wing Shun Chan, Shuyang Zhou
Method Summary |
protected void |
appendOrderByComparator(com.liferay.portal.kernel.util.StringBundler query,
java.lang.String entityAlias,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
|
void |
clearCache()
|
void |
clearCache(T model)
|
void |
closeSession(com.liferay.portal.kernel.dao.orm.Session session)
|
int |
countWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
|
T |
fetchByPrimaryKey(java.io.Serializable primaryKey)
|
T |
findByPrimaryKey(java.io.Serializable primaryKey)
|
java.util.List |
findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
|
java.util.List |
findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery,
int start,
int end)
|
java.util.List |
findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery,
int start,
int end,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
|
javax.sql.DataSource |
getDataSource()
|
com.liferay.portal.kernel.dao.db.DB |
getDB()
|
com.liferay.portal.kernel.dao.orm.Dialect |
getDialect()
|
ModelListener<T>[] |
getListeners()
|
com.liferay.portal.kernel.dao.orm.Session |
openNewSession(java.sql.Connection connection)
|
com.liferay.portal.kernel.dao.orm.Session |
openSession()
|
com.liferay.portal.SystemException |
processException(java.lang.Exception e)
|
void |
registerListener(ModelListener<T> listener)
|
T |
remove(java.io.Serializable primaryKey)
|
T |
remove(T model)
|
protected T |
removeImpl(T model)
|
void |
setDataSource(javax.sql.DataSource dataSource)
|
void |
setSessionFactory(com.liferay.portal.kernel.dao.orm.SessionFactory sessionFactory)
|
void |
unregisterListener(ModelListener<T> listener)
|
T |
update(T model,
boolean merge)
Add, update, or merge, the model. |
protected T |
updateImpl(T model,
boolean merge)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COUNT_COLUMN_NAME
public static final java.lang.String COUNT_COLUMN_NAME
- See Also:
- Constant Field Values
ORDER_BY_ASC
protected static final java.lang.String ORDER_BY_ASC
- See Also:
- Constant Field Values
ORDER_BY_ASC_HAS_NEXT
protected static final java.lang.String ORDER_BY_ASC_HAS_NEXT
- See Also:
- Constant Field Values
ORDER_BY_CLAUSE
protected static final java.lang.String ORDER_BY_CLAUSE
- See Also:
- Constant Field Values
ORDER_BY_DESC
protected static final java.lang.String ORDER_BY_DESC
- See Also:
- Constant Field Values
ORDER_BY_DESC_HAS_NEXT
protected static final java.lang.String ORDER_BY_DESC_HAS_NEXT
- See Also:
- Constant Field Values
WHERE_AND
protected static final java.lang.String WHERE_AND
- See Also:
- Constant Field Values
WHERE_LESSER_THAN
protected static final java.lang.String WHERE_LESSER_THAN
- See Also:
- Constant Field Values
WHERE_LESSER_THAN_HAS_NEXT
protected static final java.lang.String WHERE_LESSER_THAN_HAS_NEXT
- See Also:
- Constant Field Values
WHERE_GREATER_THAN
protected static final java.lang.String WHERE_GREATER_THAN
- See Also:
- Constant Field Values
WHERE_GREATER_THAN_HAS_NEXT
protected static final java.lang.String WHERE_GREATER_THAN_HAS_NEXT
- See Also:
- Constant Field Values
listeners
protected ModelListener<T extends BaseModel<T>>[] listeners
BasePersistenceImpl
public BasePersistenceImpl()
clearCache
public void clearCache()
- Specified by:
clearCache
in interface BasePersistence<T extends BaseModel<T>>
clearCache
public void clearCache(T model)
- Specified by:
clearCache
in interface BasePersistence<T extends BaseModel<T>>
closeSession
public void closeSession(com.liferay.portal.kernel.dao.orm.Session session)
- Specified by:
closeSession
in interface com.liferay.portal.kernel.dao.orm.SessionFactory
countWithDynamicQuery
public int countWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
throws com.liferay.portal.SystemException
- Specified by:
countWithDynamicQuery
in interface BasePersistence<T extends BaseModel<T>>
- Throws:
com.liferay.portal.SystemException
fetchByPrimaryKey
public T fetchByPrimaryKey(java.io.Serializable primaryKey)
throws com.liferay.portal.SystemException
- Specified by:
fetchByPrimaryKey
in interface BasePersistence<T extends BaseModel<T>>
- Throws:
com.liferay.portal.SystemException
findByPrimaryKey
public T findByPrimaryKey(java.io.Serializable primaryKey)
throws NoSuchModelException,
com.liferay.portal.SystemException
- Specified by:
findByPrimaryKey
in interface BasePersistence<T extends BaseModel<T>>
- Throws:
NoSuchModelException
com.liferay.portal.SystemException
findWithDynamicQuery
public java.util.List findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
throws com.liferay.portal.SystemException
- Specified by:
findWithDynamicQuery
in interface BasePersistence<T extends BaseModel<T>>
- Throws:
com.liferay.portal.SystemException
findWithDynamicQuery
public java.util.List findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery,
int start,
int end)
throws com.liferay.portal.SystemException
- Specified by:
findWithDynamicQuery
in interface BasePersistence<T extends BaseModel<T>>
- Throws:
com.liferay.portal.SystemException
findWithDynamicQuery
public java.util.List findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery,
int start,
int end,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.SystemException
- Specified by:
findWithDynamicQuery
in interface BasePersistence<T extends BaseModel<T>>
- Throws:
com.liferay.portal.SystemException
getDataSource
public javax.sql.DataSource getDataSource()
- Specified by:
getDataSource
in interface BasePersistence<T extends BaseModel<T>>
getDB
public com.liferay.portal.kernel.dao.db.DB getDB()
getDialect
public com.liferay.portal.kernel.dao.orm.Dialect getDialect()
- Specified by:
getDialect
in interface com.liferay.portal.kernel.dao.orm.SessionFactory
getListeners
public ModelListener<T>[] getListeners()
- Specified by:
getListeners
in interface BasePersistence<T extends BaseModel<T>>
openNewSession
public com.liferay.portal.kernel.dao.orm.Session openNewSession(java.sql.Connection connection)
throws com.liferay.portal.kernel.dao.orm.ORMException
- Specified by:
openNewSession
in interface com.liferay.portal.kernel.dao.orm.SessionFactory
- Throws:
com.liferay.portal.kernel.dao.orm.ORMException
openSession
public com.liferay.portal.kernel.dao.orm.Session openSession()
throws com.liferay.portal.kernel.dao.orm.ORMException
- Specified by:
openSession
in interface com.liferay.portal.kernel.dao.orm.SessionFactory
- Throws:
com.liferay.portal.kernel.dao.orm.ORMException
processException
public com.liferay.portal.SystemException processException(java.lang.Exception e)
registerListener
public void registerListener(ModelListener<T> listener)
- Specified by:
registerListener
in interface BasePersistence<T extends BaseModel<T>>
remove
public T remove(java.io.Serializable primaryKey)
throws NoSuchModelException,
com.liferay.portal.SystemException
- Specified by:
remove
in interface BasePersistence<T extends BaseModel<T>>
- Throws:
NoSuchModelException
com.liferay.portal.SystemException
remove
public T remove(T model)
throws com.liferay.portal.SystemException
- Specified by:
remove
in interface BasePersistence<T extends BaseModel<T>>
- Throws:
com.liferay.portal.SystemException
setDataSource
public void setDataSource(javax.sql.DataSource dataSource)
- Specified by:
setDataSource
in interface BasePersistence<T extends BaseModel<T>>
setSessionFactory
public void setSessionFactory(com.liferay.portal.kernel.dao.orm.SessionFactory sessionFactory)
unregisterListener
public void unregisterListener(ModelListener<T> listener)
- Specified by:
unregisterListener
in interface BasePersistence<T extends BaseModel<T>>
update
public T update(T model,
boolean merge)
throws com.liferay.portal.SystemException
- Add, update, or merge, the model. This method also calls the model
listeners to trigger the proper events associated with adding, deleting,
or updating a model.
- Specified by:
update
in interface BasePersistence<T extends BaseModel<T>>
- Parameters:
model
- the model to add, update, or mergemerge
- boolean value for whether to merge the entity. The default
value is false. Setting merge to true is more expensive and
should only be true when model is transient. See LEP-5473 for a
detailed discussion of this method.
- Returns:
- the model that was added, updated, or merged
- Throws:
com.liferay.portal.SystemException
appendOrderByComparator
protected void appendOrderByComparator(com.liferay.portal.kernel.util.StringBundler query,
java.lang.String entityAlias,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
removeImpl
protected T removeImpl(T model)
throws com.liferay.portal.SystemException
- Throws:
com.liferay.portal.SystemException
updateImpl
protected T updateImpl(T model,
boolean merge)
throws com.liferay.portal.SystemException
- Throws:
com.liferay.portal.SystemException