com.liferay.portal.service.persistence.impl
Class BasePersistenceImpl<T extends BaseModel<T>>

java.lang.Object
  extended by 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

Field Summary
static java.lang.String COUNT_COLUMN_NAME
           
protected  ModelListener<T>[] listeners
           
protected static java.lang.String ORDER_BY_ASC
           
protected static java.lang.String ORDER_BY_ASC_HAS_NEXT
           
protected static java.lang.String ORDER_BY_CLAUSE
           
protected static java.lang.String ORDER_BY_DESC
           
protected static java.lang.String ORDER_BY_DESC_HAS_NEXT
           
 
Constructor Summary
BasePersistenceImpl()
           
 
Method Summary
protected  void appendOrderByComparator(com.liferay.portal.kernel.util.StringBundler query, java.lang.String entityAlias, com.liferay.portal.kernel.util.OrderByComparator obc)
           
 void clearCache()
           
 void closeSession(com.liferay.portal.kernel.dao.orm.Session session)
           
 T fetchByPrimaryKey(java.io.Serializable primaryKey)
           
 T findByPrimaryKey(java.io.Serializable primaryKey)
           
 java.util.List<java.lang.Object> findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
           
 java.util.List<java.lang.Object> findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, int end)
           
 javax.sql.DataSource getDataSource()
           
 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.kernel.exception.SystemException processException(java.lang.Exception e)
           
 void registerListener(ModelListener<T> listener)
           
 T remove(java.io.Serializable primaryKey)
           
 T remove(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.
 T updateImpl(T model, boolean merge)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COUNT_COLUMN_NAME

public static final java.lang.String COUNT_COLUMN_NAME
See Also:
Constant Field Values

listeners

protected ModelListener<T extends BaseModel<T>>[] listeners

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
Constructor Detail

BasePersistenceImpl

public BasePersistenceImpl()
Method Detail

clearCache

public void clearCache()
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

findByPrimaryKey

public T findByPrimaryKey(java.io.Serializable primaryKey)
                                        throws NoSuchModelException,
                                               com.liferay.portal.kernel.exception.SystemException
Specified by:
findByPrimaryKey in interface BasePersistence<T extends BaseModel<T>>
Throws:
NoSuchModelException
com.liferay.portal.kernel.exception.SystemException

findWithDynamicQuery

public java.util.List<java.lang.Object> findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
                                                      throws com.liferay.portal.kernel.exception.SystemException
Specified by:
findWithDynamicQuery in interface BasePersistence<T extends BaseModel<T>>
Throws:
com.liferay.portal.kernel.exception.SystemException

findWithDynamicQuery

public java.util.List<java.lang.Object> findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery,
                                                             int start,
                                                             int end)
                                                      throws com.liferay.portal.kernel.exception.SystemException
Specified by:
findWithDynamicQuery in interface BasePersistence<T extends BaseModel<T>>
Throws:
com.liferay.portal.kernel.exception.SystemException

fetchByPrimaryKey

public T fetchByPrimaryKey(java.io.Serializable primaryKey)
                                         throws com.liferay.portal.kernel.exception.SystemException
Specified by:
fetchByPrimaryKey in interface BasePersistence<T extends BaseModel<T>>
Throws:
com.liferay.portal.kernel.exception.SystemException

getDataSource

public javax.sql.DataSource getDataSource()

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.kernel.exception.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.kernel.exception.SystemException
Specified by:
remove in interface BasePersistence<T extends BaseModel<T>>
Throws:
NoSuchModelException
com.liferay.portal.kernel.exception.SystemException

remove

public T remove(T model)
                              throws com.liferay.portal.kernel.exception.SystemException
Specified by:
remove in interface BasePersistence<T extends BaseModel<T>>
Throws:
com.liferay.portal.kernel.exception.SystemException

setDataSource

public void setDataSource(javax.sql.DataSource dataSource)

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.kernel.exception.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 merge
merge - 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.kernel.exception.SystemException

updateImpl

public T updateImpl(T model,
                    boolean merge)
                                  throws com.liferay.portal.kernel.exception.SystemException
Throws:
com.liferay.portal.kernel.exception.SystemException

appendOrderByComparator

protected void appendOrderByComparator(com.liferay.portal.kernel.util.StringBundler query,
                                       java.lang.String entityAlias,
                                       com.liferay.portal.kernel.util.OrderByComparator obc)