--- /dev/null
+/**
+ * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ */
+
+package com.pentila.entSavoie.cdt.service.persistence;
+
+import com.liferay.portal.NoSuchModelException;
+import com.liferay.portal.kernel.bean.BeanReference;
+import com.liferay.portal.kernel.cache.CacheRegistryUtil;
+import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
+import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
+import com.liferay.portal.kernel.dao.orm.FinderPath;
+import com.liferay.portal.kernel.dao.orm.Query;
+import com.liferay.portal.kernel.dao.orm.QueryPos;
+import com.liferay.portal.kernel.dao.orm.QueryUtil;
+import com.liferay.portal.kernel.dao.orm.Session;
+import com.liferay.portal.kernel.exception.SystemException;
+import com.liferay.portal.kernel.log.Log;
+import com.liferay.portal.kernel.log.LogFactoryUtil;
+import com.liferay.portal.kernel.portlet.PortletClassLoaderUtil;
+import com.liferay.portal.kernel.util.GetterUtil;
+import com.liferay.portal.kernel.util.InstanceFactory;
+import com.liferay.portal.kernel.util.OrderByComparator;
+import com.liferay.portal.kernel.util.PropsKeys;
+import com.liferay.portal.kernel.util.PropsUtil;
+import com.liferay.portal.kernel.util.StringBundler;
+import com.liferay.portal.kernel.util.StringPool;
+import com.liferay.portal.kernel.util.StringUtil;
+import com.liferay.portal.model.CacheModel;
+import com.liferay.portal.model.ModelListener;
+import com.liferay.portal.service.persistence.BatchSessionUtil;
+import com.liferay.portal.service.persistence.ResourcePersistence;
+import com.liferay.portal.service.persistence.UserPersistence;
+import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
+
+import com.pentila.entSavoie.cdt.NoSuchSessionStudentException;
+import com.pentila.entSavoie.cdt.model.SessionStudent;
+import com.pentila.entSavoie.cdt.model.impl.SessionStudentImpl;
+import com.pentila.entSavoie.cdt.model.impl.SessionStudentModelImpl;
+
+import java.io.Serializable;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * The persistence implementation for the session student service.
+ *
+ * <p>
+ * Caching information and settings can be found in <code>portal.properties</code>
+ * </p>
+ *
+ * @author Cedric Lecarpentier
+ * @see SessionStudentPersistence
+ * @see SessionStudentUtil
+ * @generated
+ */
+public class SessionStudentPersistenceImpl extends BasePersistenceImpl<SessionStudent>
+ implements SessionStudentPersistence {
+ /*
+ * NOTE FOR DEVELOPERS:
+ *
+ * Never modify or reference this class directly. Always use {@link SessionStudentUtil} to access the session student persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
+ */
+ public static final String FINDER_CLASS_NAME_ENTITY = SessionStudentImpl.class.getName();
+ public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
+ ".List1";
+ public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
+ ".List2";
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_SESSIONID =
+ new FinderPath(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentModelImpl.FINDER_CACHE_ENABLED,
+ SessionStudentImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findBysessionId",
+ new String[] {
+ Long.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SESSIONID =
+ new FinderPath(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentModelImpl.FINDER_CACHE_ENABLED,
+ SessionStudentImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findBysessionId",
+ new String[] { Long.class.getName() },
+ SessionStudentModelImpl.SESSIONID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_SESSIONID = new FinderPath(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countBysessionId",
+ new String[] { Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_STUDENTID =
+ new FinderPath(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentModelImpl.FINDER_CACHE_ENABLED,
+ SessionStudentImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findBystudentId",
+ new String[] {
+ Long.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STUDENTID =
+ new FinderPath(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentModelImpl.FINDER_CACHE_ENABLED,
+ SessionStudentImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findBystudentId",
+ new String[] { Long.class.getName() },
+ SessionStudentModelImpl.STUDENTID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_STUDENTID = new FinderPath(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countBystudentId",
+ new String[] { Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_SESSIONID_STUDENTID =
+ new FinderPath(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentModelImpl.FINDER_CACHE_ENABLED,
+ SessionStudentImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findBysessionId_studentId",
+ new String[] {
+ Long.class.getName(), Long.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SESSIONID_STUDENTID =
+ new FinderPath(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentModelImpl.FINDER_CACHE_ENABLED,
+ SessionStudentImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "findBysessionId_studentId",
+ new String[] { Long.class.getName(), Long.class.getName() },
+ SessionStudentModelImpl.SESSIONID_COLUMN_BITMASK |
+ SessionStudentModelImpl.STUDENTID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_SESSIONID_STUDENTID = new FinderPath(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countBysessionId_studentId",
+ new String[] { Long.class.getName(), Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentModelImpl.FINDER_CACHE_ENABLED,
+ SessionStudentImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findAll", new String[0]);
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentModelImpl.FINDER_CACHE_ENABLED,
+ SessionStudentImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
+ public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
+
+ /**
+ * Caches the session student in the entity cache if it is enabled.
+ *
+ * @param sessionStudent the session student
+ */
+ public void cacheResult(SessionStudent sessionStudent) {
+ EntityCacheUtil.putResult(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentImpl.class, sessionStudent.getPrimaryKey(),
+ sessionStudent);
+
+ sessionStudent.resetOriginalValues();
+ }
+
+ /**
+ * Caches the session students in the entity cache if it is enabled.
+ *
+ * @param sessionStudents the session students
+ */
+ public void cacheResult(List<SessionStudent> sessionStudents) {
+ for (SessionStudent sessionStudent : sessionStudents) {
+ if (EntityCacheUtil.getResult(
+ SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentImpl.class, sessionStudent.getPrimaryKey()) == null) {
+ cacheResult(sessionStudent);
+ }
+ else {
+ sessionStudent.resetOriginalValues();
+ }
+ }
+ }
+
+ /**
+ * Clears the cache for all session students.
+ *
+ * <p>
+ * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
+ * </p>
+ */
+ @Override
+ public void clearCache() {
+ if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
+ CacheRegistryUtil.clear(SessionStudentImpl.class.getName());
+ }
+
+ EntityCacheUtil.clearCache(SessionStudentImpl.class.getName());
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ /**
+ * Clears the cache for the session student.
+ *
+ * <p>
+ * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
+ * </p>
+ */
+ @Override
+ public void clearCache(SessionStudent sessionStudent) {
+ EntityCacheUtil.removeResult(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentImpl.class, sessionStudent.getPrimaryKey());
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ @Override
+ public void clearCache(List<SessionStudent> sessionStudents) {
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+
+ for (SessionStudent sessionStudent : sessionStudents) {
+ EntityCacheUtil.removeResult(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentImpl.class, sessionStudent.getPrimaryKey());
+ }
+ }
+
+ /**
+ * Creates a new session student with the primary key. Does not add the session student to the database.
+ *
+ * @param sessionStudentId the primary key for the new session student
+ * @return the new session student
+ */
+ public SessionStudent create(long sessionStudentId) {
+ SessionStudent sessionStudent = new SessionStudentImpl();
+
+ sessionStudent.setNew(true);
+ sessionStudent.setPrimaryKey(sessionStudentId);
+
+ return sessionStudent;
+ }
+
+ /**
+ * Removes the session student with the primary key from the database. Also notifies the appropriate model listeners.
+ *
+ * @param sessionStudentId the primary key of the session student
+ * @return the session student that was removed
+ * @throws com.pentila.entSavoie.cdt.NoSuchSessionStudentException if a session student with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent remove(long sessionStudentId)
+ throws NoSuchSessionStudentException, SystemException {
+ return remove(Long.valueOf(sessionStudentId));
+ }
+
+ /**
+ * Removes the session student with the primary key from the database. Also notifies the appropriate model listeners.
+ *
+ * @param primaryKey the primary key of the session student
+ * @return the session student that was removed
+ * @throws com.pentila.entSavoie.cdt.NoSuchSessionStudentException if a session student with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public SessionStudent remove(Serializable primaryKey)
+ throws NoSuchSessionStudentException, SystemException {
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ SessionStudent sessionStudent = (SessionStudent)session.get(SessionStudentImpl.class,
+ primaryKey);
+
+ if (sessionStudent == null) {
+ if (_log.isWarnEnabled()) {
+ _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
+ }
+
+ throw new NoSuchSessionStudentException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ primaryKey);
+ }
+
+ return remove(sessionStudent);
+ }
+ catch (NoSuchSessionStudentException nsee) {
+ throw nsee;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ @Override
+ protected SessionStudent removeImpl(SessionStudent sessionStudent)
+ throws SystemException {
+ sessionStudent = toUnwrappedModel(sessionStudent);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ BatchSessionUtil.delete(session, sessionStudent);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+
+ clearCache(sessionStudent);
+
+ return sessionStudent;
+ }
+
+ @Override
+ public SessionStudent updateImpl(
+ com.pentila.entSavoie.cdt.model.SessionStudent sessionStudent,
+ boolean merge) throws SystemException {
+ sessionStudent = toUnwrappedModel(sessionStudent);
+
+ boolean isNew = sessionStudent.isNew();
+
+ SessionStudentModelImpl sessionStudentModelImpl = (SessionStudentModelImpl)sessionStudent;
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ BatchSessionUtil.update(session, sessionStudent, merge);
+
+ sessionStudent.setNew(false);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+
+ if (isNew || !SessionStudentModelImpl.COLUMN_BITMASK_ENABLED) {
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ else {
+ if ((sessionStudentModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SESSIONID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(sessionStudentModelImpl.getOriginalSessionId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SESSIONID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SESSIONID,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(sessionStudentModelImpl.getSessionId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SESSIONID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SESSIONID,
+ args);
+ }
+
+ if ((sessionStudentModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STUDENTID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(sessionStudentModelImpl.getOriginalStudentId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_STUDENTID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STUDENTID,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(sessionStudentModelImpl.getStudentId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_STUDENTID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STUDENTID,
+ args);
+ }
+
+ if ((sessionStudentModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SESSIONID_STUDENTID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(sessionStudentModelImpl.getOriginalSessionId()),
+ Long.valueOf(sessionStudentModelImpl.getOriginalStudentId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SESSIONID_STUDENTID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SESSIONID_STUDENTID,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(sessionStudentModelImpl.getSessionId()),
+ Long.valueOf(sessionStudentModelImpl.getStudentId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SESSIONID_STUDENTID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SESSIONID_STUDENTID,
+ args);
+ }
+ }
+
+ EntityCacheUtil.putResult(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentImpl.class, sessionStudent.getPrimaryKey(),
+ sessionStudent);
+
+ return sessionStudent;
+ }
+
+ protected SessionStudent toUnwrappedModel(SessionStudent sessionStudent) {
+ if (sessionStudent instanceof SessionStudentImpl) {
+ return sessionStudent;
+ }
+
+ SessionStudentImpl sessionStudentImpl = new SessionStudentImpl();
+
+ sessionStudentImpl.setNew(sessionStudent.isNew());
+ sessionStudentImpl.setPrimaryKey(sessionStudent.getPrimaryKey());
+
+ sessionStudentImpl.setSessionStudentId(sessionStudent.getSessionStudentId());
+ sessionStudentImpl.setSessionId(sessionStudent.getSessionId());
+ sessionStudentImpl.setStudentId(sessionStudent.getStudentId());
+
+ return sessionStudentImpl;
+ }
+
+ /**
+ * Returns the session student with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
+ *
+ * @param primaryKey the primary key of the session student
+ * @return the session student
+ * @throws com.liferay.portal.NoSuchModelException if a session student with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public SessionStudent findByPrimaryKey(Serializable primaryKey)
+ throws NoSuchModelException, SystemException {
+ return findByPrimaryKey(((Long)primaryKey).longValue());
+ }
+
+ /**
+ * Returns the session student with the primary key or throws a {@link com.pentila.entSavoie.cdt.NoSuchSessionStudentException} if it could not be found.
+ *
+ * @param sessionStudentId the primary key of the session student
+ * @return the session student
+ * @throws com.pentila.entSavoie.cdt.NoSuchSessionStudentException if a session student with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent findByPrimaryKey(long sessionStudentId)
+ throws NoSuchSessionStudentException, SystemException {
+ SessionStudent sessionStudent = fetchByPrimaryKey(sessionStudentId);
+
+ if (sessionStudent == null) {
+ if (_log.isWarnEnabled()) {
+ _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + sessionStudentId);
+ }
+
+ throw new NoSuchSessionStudentException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ sessionStudentId);
+ }
+
+ return sessionStudent;
+ }
+
+ /**
+ * Returns the session student with the primary key or returns <code>null</code> if it could not be found.
+ *
+ * @param primaryKey the primary key of the session student
+ * @return the session student, or <code>null</code> if a session student with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public SessionStudent fetchByPrimaryKey(Serializable primaryKey)
+ throws SystemException {
+ return fetchByPrimaryKey(((Long)primaryKey).longValue());
+ }
+
+ /**
+ * Returns the session student with the primary key or returns <code>null</code> if it could not be found.
+ *
+ * @param sessionStudentId the primary key of the session student
+ * @return the session student, or <code>null</code> if a session student with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent fetchByPrimaryKey(long sessionStudentId)
+ throws SystemException {
+ SessionStudent sessionStudent = (SessionStudent)EntityCacheUtil.getResult(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentImpl.class, sessionStudentId);
+
+ if (sessionStudent == _nullSessionStudent) {
+ return null;
+ }
+
+ if (sessionStudent == null) {
+ Session session = null;
+
+ boolean hasException = false;
+
+ try {
+ session = openSession();
+
+ sessionStudent = (SessionStudent)session.get(SessionStudentImpl.class,
+ Long.valueOf(sessionStudentId));
+ }
+ catch (Exception e) {
+ hasException = true;
+
+ throw processException(e);
+ }
+ finally {
+ if (sessionStudent != null) {
+ cacheResult(sessionStudent);
+ }
+ else if (!hasException) {
+ EntityCacheUtil.putResult(SessionStudentModelImpl.ENTITY_CACHE_ENABLED,
+ SessionStudentImpl.class, sessionStudentId,
+ _nullSessionStudent);
+ }
+
+ closeSession(session);
+ }
+ }
+
+ return sessionStudent;
+ }
+
+ /**
+ * Returns all the session students where sessionId = ?.
+ *
+ * @param sessionId the session ID
+ * @return the matching session students
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SessionStudent> findBysessionId(long sessionId)
+ throws SystemException {
+ return findBysessionId(sessionId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
+ null);
+ }
+
+ /**
+ * Returns a range of all the session students where sessionId = ?.
+ *
+ * <p>
+ * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
+ * </p>
+ *
+ * @param sessionId the session ID
+ * @param start the lower bound of the range of session students
+ * @param end the upper bound of the range of session students (not inclusive)
+ * @return the range of matching session students
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SessionStudent> findBysessionId(long sessionId, int start,
+ int end) throws SystemException {
+ return findBysessionId(sessionId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the session students where sessionId = ?.
+ *
+ * <p>
+ * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
+ * </p>
+ *
+ * @param sessionId the session ID
+ * @param start the lower bound of the range of session students
+ * @param end the upper bound of the range of session students (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching session students
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SessionStudent> findBysessionId(long sessionId, int start,
+ int end, OrderByComparator orderByComparator) throws SystemException {
+ FinderPath finderPath = null;
+ Object[] finderArgs = null;
+
+ if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
+ (orderByComparator == null)) {
+ finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SESSIONID;
+ finderArgs = new Object[] { sessionId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_SESSIONID;
+ finderArgs = new Object[] { sessionId, start, end, orderByComparator };
+ }
+
+ List<SessionStudent> list = (List<SessionStudent>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (SessionStudent sessionStudent : list) {
+ if ((sessionId != sessionStudent.getSessionId())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(3 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(2);
+ }
+
+ query.append(_SQL_SELECT_SESSIONSTUDENT_WHERE);
+
+ query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_2);
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(sessionId);
+
+ list = (List<SessionStudent>)QueryUtil.list(q, getDialect(),
+ start, end);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (list == null) {
+ FinderCacheUtil.removeResult(finderPath, finderArgs);
+ }
+ else {
+ cacheResult(list);
+
+ FinderCacheUtil.putResult(finderPath, finderArgs, list);
+ }
+
+ closeSession(session);
+ }
+ }
+
+ return list;
+ }
+
+ /**
+ * Returns the first session student in the ordered set where sessionId = ?.
+ *
+ * @param sessionId the session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching session student
+ * @throws com.pentila.entSavoie.cdt.NoSuchSessionStudentException if a matching session student could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent findBysessionId_First(long sessionId,
+ OrderByComparator orderByComparator)
+ throws NoSuchSessionStudentException, SystemException {
+ SessionStudent sessionStudent = fetchBysessionId_First(sessionId,
+ orderByComparator);
+
+ if (sessionStudent != null) {
+ return sessionStudent;
+ }
+
+ StringBundler msg = new StringBundler(4);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("sessionId=");
+ msg.append(sessionId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchSessionStudentException(msg.toString());
+ }
+
+ /**
+ * Returns the first session student in the ordered set where sessionId = ?.
+ *
+ * @param sessionId the session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching session student, or <code>null</code> if a matching session student could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent fetchBysessionId_First(long sessionId,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<SessionStudent> list = findBysessionId(sessionId, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last session student in the ordered set where sessionId = ?.
+ *
+ * @param sessionId the session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching session student
+ * @throws com.pentila.entSavoie.cdt.NoSuchSessionStudentException if a matching session student could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent findBysessionId_Last(long sessionId,
+ OrderByComparator orderByComparator)
+ throws NoSuchSessionStudentException, SystemException {
+ SessionStudent sessionStudent = fetchBysessionId_Last(sessionId,
+ orderByComparator);
+
+ if (sessionStudent != null) {
+ return sessionStudent;
+ }
+
+ StringBundler msg = new StringBundler(4);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("sessionId=");
+ msg.append(sessionId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchSessionStudentException(msg.toString());
+ }
+
+ /**
+ * Returns the last session student in the ordered set where sessionId = ?.
+ *
+ * @param sessionId the session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching session student, or <code>null</code> if a matching session student could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent fetchBysessionId_Last(long sessionId,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countBysessionId(sessionId);
+
+ List<SessionStudent> list = findBysessionId(sessionId, count - 1,
+ count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the session students before and after the current session student in the ordered set where sessionId = ?.
+ *
+ * @param sessionStudentId the primary key of the current session student
+ * @param sessionId the session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next session student
+ * @throws com.pentila.entSavoie.cdt.NoSuchSessionStudentException if a session student with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent[] findBysessionId_PrevAndNext(long sessionStudentId,
+ long sessionId, OrderByComparator orderByComparator)
+ throws NoSuchSessionStudentException, SystemException {
+ SessionStudent sessionStudent = findByPrimaryKey(sessionStudentId);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ SessionStudent[] array = new SessionStudentImpl[3];
+
+ array[0] = getBysessionId_PrevAndNext(session, sessionStudent,
+ sessionId, orderByComparator, true);
+
+ array[1] = sessionStudent;
+
+ array[2] = getBysessionId_PrevAndNext(session, sessionStudent,
+ sessionId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected SessionStudent getBysessionId_PrevAndNext(Session session,
+ SessionStudent sessionStudent, long sessionId,
+ OrderByComparator orderByComparator, boolean previous) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(6 +
+ (orderByComparator.getOrderByFields().length * 6));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_SESSIONSTUDENT_WHERE);
+
+ query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_2);
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(sessionId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(sessionStudent);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<SessionStudent> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the session students where studentId = ?.
+ *
+ * @param studentId the student ID
+ * @return the matching session students
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SessionStudent> findBystudentId(long studentId)
+ throws SystemException {
+ return findBystudentId(studentId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
+ null);
+ }
+
+ /**
+ * Returns a range of all the session students where studentId = ?.
+ *
+ * <p>
+ * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
+ * </p>
+ *
+ * @param studentId the student ID
+ * @param start the lower bound of the range of session students
+ * @param end the upper bound of the range of session students (not inclusive)
+ * @return the range of matching session students
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SessionStudent> findBystudentId(long studentId, int start,
+ int end) throws SystemException {
+ return findBystudentId(studentId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the session students where studentId = ?.
+ *
+ * <p>
+ * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
+ * </p>
+ *
+ * @param studentId the student ID
+ * @param start the lower bound of the range of session students
+ * @param end the upper bound of the range of session students (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching session students
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SessionStudent> findBystudentId(long studentId, int start,
+ int end, OrderByComparator orderByComparator) throws SystemException {
+ FinderPath finderPath = null;
+ Object[] finderArgs = null;
+
+ if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
+ (orderByComparator == null)) {
+ finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STUDENTID;
+ finderArgs = new Object[] { studentId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_STUDENTID;
+ finderArgs = new Object[] { studentId, start, end, orderByComparator };
+ }
+
+ List<SessionStudent> list = (List<SessionStudent>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (SessionStudent sessionStudent : list) {
+ if ((studentId != sessionStudent.getStudentId())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(3 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(2);
+ }
+
+ query.append(_SQL_SELECT_SESSIONSTUDENT_WHERE);
+
+ query.append(_FINDER_COLUMN_STUDENTID_STUDENTID_2);
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(studentId);
+
+ list = (List<SessionStudent>)QueryUtil.list(q, getDialect(),
+ start, end);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (list == null) {
+ FinderCacheUtil.removeResult(finderPath, finderArgs);
+ }
+ else {
+ cacheResult(list);
+
+ FinderCacheUtil.putResult(finderPath, finderArgs, list);
+ }
+
+ closeSession(session);
+ }
+ }
+
+ return list;
+ }
+
+ /**
+ * Returns the first session student in the ordered set where studentId = ?.
+ *
+ * @param studentId the student ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching session student
+ * @throws com.pentila.entSavoie.cdt.NoSuchSessionStudentException if a matching session student could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent findBystudentId_First(long studentId,
+ OrderByComparator orderByComparator)
+ throws NoSuchSessionStudentException, SystemException {
+ SessionStudent sessionStudent = fetchBystudentId_First(studentId,
+ orderByComparator);
+
+ if (sessionStudent != null) {
+ return sessionStudent;
+ }
+
+ StringBundler msg = new StringBundler(4);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("studentId=");
+ msg.append(studentId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchSessionStudentException(msg.toString());
+ }
+
+ /**
+ * Returns the first session student in the ordered set where studentId = ?.
+ *
+ * @param studentId the student ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching session student, or <code>null</code> if a matching session student could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent fetchBystudentId_First(long studentId,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<SessionStudent> list = findBystudentId(studentId, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last session student in the ordered set where studentId = ?.
+ *
+ * @param studentId the student ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching session student
+ * @throws com.pentila.entSavoie.cdt.NoSuchSessionStudentException if a matching session student could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent findBystudentId_Last(long studentId,
+ OrderByComparator orderByComparator)
+ throws NoSuchSessionStudentException, SystemException {
+ SessionStudent sessionStudent = fetchBystudentId_Last(studentId,
+ orderByComparator);
+
+ if (sessionStudent != null) {
+ return sessionStudent;
+ }
+
+ StringBundler msg = new StringBundler(4);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("studentId=");
+ msg.append(studentId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchSessionStudentException(msg.toString());
+ }
+
+ /**
+ * Returns the last session student in the ordered set where studentId = ?.
+ *
+ * @param studentId the student ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching session student, or <code>null</code> if a matching session student could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent fetchBystudentId_Last(long studentId,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countBystudentId(studentId);
+
+ List<SessionStudent> list = findBystudentId(studentId, count - 1,
+ count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the session students before and after the current session student in the ordered set where studentId = ?.
+ *
+ * @param sessionStudentId the primary key of the current session student
+ * @param studentId the student ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next session student
+ * @throws com.pentila.entSavoie.cdt.NoSuchSessionStudentException if a session student with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent[] findBystudentId_PrevAndNext(long sessionStudentId,
+ long studentId, OrderByComparator orderByComparator)
+ throws NoSuchSessionStudentException, SystemException {
+ SessionStudent sessionStudent = findByPrimaryKey(sessionStudentId);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ SessionStudent[] array = new SessionStudentImpl[3];
+
+ array[0] = getBystudentId_PrevAndNext(session, sessionStudent,
+ studentId, orderByComparator, true);
+
+ array[1] = sessionStudent;
+
+ array[2] = getBystudentId_PrevAndNext(session, sessionStudent,
+ studentId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected SessionStudent getBystudentId_PrevAndNext(Session session,
+ SessionStudent sessionStudent, long studentId,
+ OrderByComparator orderByComparator, boolean previous) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(6 +
+ (orderByComparator.getOrderByFields().length * 6));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_SESSIONSTUDENT_WHERE);
+
+ query.append(_FINDER_COLUMN_STUDENTID_STUDENTID_2);
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(studentId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(sessionStudent);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<SessionStudent> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the session students where sessionId = ? and studentId = ?.
+ *
+ * @param sessionId the session ID
+ * @param studentId the student ID
+ * @return the matching session students
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SessionStudent> findBysessionId_studentId(long sessionId,
+ long studentId) throws SystemException {
+ return findBysessionId_studentId(sessionId, studentId,
+ QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the session students where sessionId = ? and studentId = ?.
+ *
+ * <p>
+ * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
+ * </p>
+ *
+ * @param sessionId the session ID
+ * @param studentId the student ID
+ * @param start the lower bound of the range of session students
+ * @param end the upper bound of the range of session students (not inclusive)
+ * @return the range of matching session students
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SessionStudent> findBysessionId_studentId(long sessionId,
+ long studentId, int start, int end) throws SystemException {
+ return findBysessionId_studentId(sessionId, studentId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the session students where sessionId = ? and studentId = ?.
+ *
+ * <p>
+ * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
+ * </p>
+ *
+ * @param sessionId the session ID
+ * @param studentId the student ID
+ * @param start the lower bound of the range of session students
+ * @param end the upper bound of the range of session students (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching session students
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SessionStudent> findBysessionId_studentId(long sessionId,
+ long studentId, int start, int end, OrderByComparator orderByComparator)
+ throws SystemException {
+ FinderPath finderPath = null;
+ Object[] finderArgs = null;
+
+ if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
+ (orderByComparator == null)) {
+ finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SESSIONID_STUDENTID;
+ finderArgs = new Object[] { sessionId, studentId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_SESSIONID_STUDENTID;
+ finderArgs = new Object[] {
+ sessionId, studentId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<SessionStudent> list = (List<SessionStudent>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (SessionStudent sessionStudent : list) {
+ if ((sessionId != sessionStudent.getSessionId()) ||
+ (studentId != sessionStudent.getStudentId())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(4 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_SESSIONSTUDENT_WHERE);
+
+ query.append(_FINDER_COLUMN_SESSIONID_STUDENTID_SESSIONID_2);
+
+ query.append(_FINDER_COLUMN_SESSIONID_STUDENTID_STUDENTID_2);
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(sessionId);
+
+ qPos.add(studentId);
+
+ list = (List<SessionStudent>)QueryUtil.list(q, getDialect(),
+ start, end);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (list == null) {
+ FinderCacheUtil.removeResult(finderPath, finderArgs);
+ }
+ else {
+ cacheResult(list);
+
+ FinderCacheUtil.putResult(finderPath, finderArgs, list);
+ }
+
+ closeSession(session);
+ }
+ }
+
+ return list;
+ }
+
+ /**
+ * Returns the first session student in the ordered set where sessionId = ? and studentId = ?.
+ *
+ * @param sessionId the session ID
+ * @param studentId the student ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching session student
+ * @throws com.pentila.entSavoie.cdt.NoSuchSessionStudentException if a matching session student could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent findBysessionId_studentId_First(long sessionId,
+ long studentId, OrderByComparator orderByComparator)
+ throws NoSuchSessionStudentException, SystemException {
+ SessionStudent sessionStudent = fetchBysessionId_studentId_First(sessionId,
+ studentId, orderByComparator);
+
+ if (sessionStudent != null) {
+ return sessionStudent;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("sessionId=");
+ msg.append(sessionId);
+
+ msg.append(", studentId=");
+ msg.append(studentId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchSessionStudentException(msg.toString());
+ }
+
+ /**
+ * Returns the first session student in the ordered set where sessionId = ? and studentId = ?.
+ *
+ * @param sessionId the session ID
+ * @param studentId the student ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching session student, or <code>null</code> if a matching session student could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent fetchBysessionId_studentId_First(long sessionId,
+ long studentId, OrderByComparator orderByComparator)
+ throws SystemException {
+ List<SessionStudent> list = findBysessionId_studentId(sessionId,
+ studentId, 0, 1, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last session student in the ordered set where sessionId = ? and studentId = ?.
+ *
+ * @param sessionId the session ID
+ * @param studentId the student ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching session student
+ * @throws com.pentila.entSavoie.cdt.NoSuchSessionStudentException if a matching session student could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent findBysessionId_studentId_Last(long sessionId,
+ long studentId, OrderByComparator orderByComparator)
+ throws NoSuchSessionStudentException, SystemException {
+ SessionStudent sessionStudent = fetchBysessionId_studentId_Last(sessionId,
+ studentId, orderByComparator);
+
+ if (sessionStudent != null) {
+ return sessionStudent;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("sessionId=");
+ msg.append(sessionId);
+
+ msg.append(", studentId=");
+ msg.append(studentId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchSessionStudentException(msg.toString());
+ }
+
+ /**
+ * Returns the last session student in the ordered set where sessionId = ? and studentId = ?.
+ *
+ * @param sessionId the session ID
+ * @param studentId the student ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching session student, or <code>null</code> if a matching session student could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent fetchBysessionId_studentId_Last(long sessionId,
+ long studentId, OrderByComparator orderByComparator)
+ throws SystemException {
+ int count = countBysessionId_studentId(sessionId, studentId);
+
+ List<SessionStudent> list = findBysessionId_studentId(sessionId,
+ studentId, count - 1, count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the session students before and after the current session student in the ordered set where sessionId = ? and studentId = ?.
+ *
+ * @param sessionStudentId the primary key of the current session student
+ * @param sessionId the session ID
+ * @param studentId the student ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next session student
+ * @throws com.pentila.entSavoie.cdt.NoSuchSessionStudentException if a session student with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SessionStudent[] findBysessionId_studentId_PrevAndNext(
+ long sessionStudentId, long sessionId, long studentId,
+ OrderByComparator orderByComparator)
+ throws NoSuchSessionStudentException, SystemException {
+ SessionStudent sessionStudent = findByPrimaryKey(sessionStudentId);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ SessionStudent[] array = new SessionStudentImpl[3];
+
+ array[0] = getBysessionId_studentId_PrevAndNext(session,
+ sessionStudent, sessionId, studentId, orderByComparator,
+ true);
+
+ array[1] = sessionStudent;
+
+ array[2] = getBysessionId_studentId_PrevAndNext(session,
+ sessionStudent, sessionId, studentId, orderByComparator,
+ false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected SessionStudent getBysessionId_studentId_PrevAndNext(
+ Session session, SessionStudent sessionStudent, long sessionId,
+ long studentId, OrderByComparator orderByComparator, boolean previous) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(6 +
+ (orderByComparator.getOrderByFields().length * 6));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_SESSIONSTUDENT_WHERE);
+
+ query.append(_FINDER_COLUMN_SESSIONID_STUDENTID_SESSIONID_2);
+
+ query.append(_FINDER_COLUMN_SESSIONID_STUDENTID_STUDENTID_2);
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(sessionId);
+
+ qPos.add(studentId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(sessionStudent);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<SessionStudent> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the session students.
+ *
+ * @return the session students
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SessionStudent> findAll() throws SystemException {
+ return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the session students.
+ *
+ * <p>
+ * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
+ * </p>
+ *
+ * @param start the lower bound of the range of session students
+ * @param end the upper bound of the range of session students (not inclusive)
+ * @return the range of session students
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SessionStudent> findAll(int start, int end)
+ throws SystemException {
+ return findAll(start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the session students.
+ *
+ * <p>
+ * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
+ * </p>
+ *
+ * @param start the lower bound of the range of session students
+ * @param end the upper bound of the range of session students (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of session students
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SessionStudent> findAll(int start, int end,
+ OrderByComparator orderByComparator) throws SystemException {
+ FinderPath finderPath = null;
+ Object[] finderArgs = new Object[] { start, end, orderByComparator };
+
+ if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
+ (orderByComparator == null)) {
+ finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
+ finderArgs = FINDER_ARGS_EMPTY;
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
+ finderArgs = new Object[] { start, end, orderByComparator };
+ }
+
+ List<SessionStudent> list = (List<SessionStudent>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if (list == null) {
+ StringBundler query = null;
+ String sql = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(2 +
+ (orderByComparator.getOrderByFields().length * 3));
+
+ query.append(_SQL_SELECT_SESSIONSTUDENT);
+
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+
+ sql = query.toString();
+ }
+ else {
+ sql = _SQL_SELECT_SESSIONSTUDENT;
+ }
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ if (orderByComparator == null) {
+ list = (List<SessionStudent>)QueryUtil.list(q,
+ getDialect(), start, end, false);
+
+ Collections.sort(list);
+ }
+ else {
+ list = (List<SessionStudent>)QueryUtil.list(q,
+ getDialect(), start, end);
+ }
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (list == null) {
+ FinderCacheUtil.removeResult(finderPath, finderArgs);
+ }
+ else {
+ cacheResult(list);
+
+ FinderCacheUtil.putResult(finderPath, finderArgs, list);
+ }
+
+ closeSession(session);
+ }
+ }
+
+ return list;
+ }
+
+ /**
+ * Removes all the session students where sessionId = ? from the database.
+ *
+ * @param sessionId the session ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeBysessionId(long sessionId) throws SystemException {
+ for (SessionStudent sessionStudent : findBysessionId(sessionId)) {
+ remove(sessionStudent);
+ }
+ }
+
+ /**
+ * Removes all the session students where studentId = ? from the database.
+ *
+ * @param studentId the student ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeBystudentId(long studentId) throws SystemException {
+ for (SessionStudent sessionStudent : findBystudentId(studentId)) {
+ remove(sessionStudent);
+ }
+ }
+
+ /**
+ * Removes all the session students where sessionId = ? and studentId = ? from the database.
+ *
+ * @param sessionId the session ID
+ * @param studentId the student ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeBysessionId_studentId(long sessionId, long studentId)
+ throws SystemException {
+ for (SessionStudent sessionStudent : findBysessionId_studentId(
+ sessionId, studentId)) {
+ remove(sessionStudent);
+ }
+ }
+
+ /**
+ * Removes all the session students from the database.
+ *
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeAll() throws SystemException {
+ for (SessionStudent sessionStudent : findAll()) {
+ remove(sessionStudent);
+ }
+ }
+
+ /**
+ * Returns the number of session students where sessionId = ?.
+ *
+ * @param sessionId the session ID
+ * @return the number of matching session students
+ * @throws SystemException if a system exception occurred
+ */
+ public int countBysessionId(long sessionId) throws SystemException {
+ Object[] finderArgs = new Object[] { sessionId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SESSIONID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(2);
+
+ query.append(_SQL_COUNT_SESSIONSTUDENT_WHERE);
+
+ query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(sessionId);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SESSIONID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of session students where studentId = ?.
+ *
+ * @param studentId the student ID
+ * @return the number of matching session students
+ * @throws SystemException if a system exception occurred
+ */
+ public int countBystudentId(long studentId) throws SystemException {
+ Object[] finderArgs = new Object[] { studentId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_STUDENTID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(2);
+
+ query.append(_SQL_COUNT_SESSIONSTUDENT_WHERE);
+
+ query.append(_FINDER_COLUMN_STUDENTID_STUDENTID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(studentId);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_STUDENTID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of session students where sessionId = ? and studentId = ?.
+ *
+ * @param sessionId the session ID
+ * @param studentId the student ID
+ * @return the number of matching session students
+ * @throws SystemException if a system exception occurred
+ */
+ public int countBysessionId_studentId(long sessionId, long studentId)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { sessionId, studentId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SESSIONID_STUDENTID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_SESSIONSTUDENT_WHERE);
+
+ query.append(_FINDER_COLUMN_SESSIONID_STUDENTID_SESSIONID_2);
+
+ query.append(_FINDER_COLUMN_SESSIONID_STUDENTID_STUDENTID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(sessionId);
+
+ qPos.add(studentId);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SESSIONID_STUDENTID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of session students.
+ *
+ * @return the number of session students
+ * @throws SystemException if a system exception occurred
+ */
+ public int countAll() throws SystemException {
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
+ FINDER_ARGS_EMPTY, this);
+
+ if (count == null) {
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(_SQL_COUNT_SESSIONSTUDENT);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
+ FINDER_ARGS_EMPTY, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Initializes the session student persistence.
+ */
+ public void afterPropertiesSet() {
+ String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
+ com.liferay.util.service.ServiceProps.get(
+ "value.object.listener.com.pentila.entSavoie.cdt.model.SessionStudent")));
+
+ if (listenerClassNames.length > 0) {
+ try {
+ List<ModelListener<SessionStudent>> listenersList = new ArrayList<ModelListener<SessionStudent>>();
+
+ for (String listenerClassName : listenerClassNames) {
+ listenersList.add((ModelListener<SessionStudent>)InstanceFactory.newInstance(
+ PortletClassLoaderUtil.getClassLoader(),
+ listenerClassName, (Class<?>[])null, (Object[])null));
+ }
+
+ listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
+ }
+ catch (Exception e) {
+ _log.error(e);
+ }
+ }
+ }
+
+ public void destroy() {
+ EntityCacheUtil.removeCache(SessionStudentImpl.class.getName());
+ FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
+ FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ @BeanReference(type = CDTSessionPersistence.class)
+ protected CDTSessionPersistence cdtSessionPersistence;
+ @BeanReference(type = ConfigurationPersistence.class)
+ protected ConfigurationPersistence configurationPersistence;
+ @BeanReference(type = DailySchedulePersistence.class)
+ protected DailySchedulePersistence dailySchedulePersistence;
+ @BeanReference(type = HomeworkPersistence.class)
+ protected HomeworkPersistence homeworkPersistence;
+ @BeanReference(type = HomeworkDonePersistence.class)
+ protected HomeworkDonePersistence homeworkDonePersistence;
+ @BeanReference(type = HomeworkDropboxFolderPersistence.class)
+ protected HomeworkDropboxFolderPersistence homeworkDropboxFolderPersistence;
+ @BeanReference(type = SchoolSubjectPersistence.class)
+ protected SchoolSubjectPersistence schoolSubjectPersistence;
+ @BeanReference(type = SessionStudentPersistence.class)
+ protected SessionStudentPersistence sessionStudentPersistence;
+ @BeanReference(type = SessionTeacherPersistence.class)
+ protected SessionTeacherPersistence sessionTeacherPersistence;
+ @BeanReference(type = StudentHomeworkPersistence.class)
+ protected StudentHomeworkPersistence studentHomeworkPersistence;
+ @BeanReference(type = SubjectPersistence.class)
+ protected SubjectPersistence subjectPersistence;
+ @BeanReference(type = TeacherGroupColorPersistence.class)
+ protected TeacherGroupColorPersistence teacherGroupColorPersistence;
+ @BeanReference(type = VisaPersistence.class)
+ protected VisaPersistence visaPersistence;
+ @BeanReference(type = WeeklySchedulePersistence.class)
+ protected WeeklySchedulePersistence weeklySchedulePersistence;
+ @BeanReference(type = ResourcePersistence.class)
+ protected ResourcePersistence resourcePersistence;
+ @BeanReference(type = UserPersistence.class)
+ protected UserPersistence userPersistence;
+ private static final String _SQL_SELECT_SESSIONSTUDENT = "SELECT sessionStudent FROM SessionStudent sessionStudent";
+ private static final String _SQL_SELECT_SESSIONSTUDENT_WHERE = "SELECT sessionStudent FROM SessionStudent sessionStudent WHERE ";
+ private static final String _SQL_COUNT_SESSIONSTUDENT = "SELECT COUNT(sessionStudent) FROM SessionStudent sessionStudent";
+ private static final String _SQL_COUNT_SESSIONSTUDENT_WHERE = "SELECT COUNT(sessionStudent) FROM SessionStudent sessionStudent WHERE ";
+ private static final String _FINDER_COLUMN_SESSIONID_SESSIONID_2 = "sessionStudent.sessionId = ?";
+ private static final String _FINDER_COLUMN_STUDENTID_STUDENTID_2 = "sessionStudent.studentId = ?";
+ private static final String _FINDER_COLUMN_SESSIONID_STUDENTID_SESSIONID_2 = "sessionStudent.sessionId = ? AND ";
+ private static final String _FINDER_COLUMN_SESSIONID_STUDENTID_STUDENTID_2 = "sessionStudent.studentId = ?";
+ private static final String _ORDER_BY_ENTITY_ALIAS = "sessionStudent.";
+ private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SessionStudent exists with the primary key ";
+ private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SessionStudent exists with the key {";
+ private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = GetterUtil.getBoolean(PropsUtil.get(
+ PropsKeys.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE));
+ private static Log _log = LogFactoryUtil.getLog(SessionStudentPersistenceImpl.class);
+ private static SessionStudent _nullSessionStudent = new SessionStudentImpl() {
+ @Override
+ public Object clone() {
+ return this;
+ }
+
+ @Override
+ public CacheModel<SessionStudent> toCacheModel() {
+ return _nullSessionStudentCacheModel;
+ }
+ };
+
+ private static CacheModel<SessionStudent> _nullSessionStudentCacheModel = new CacheModel<SessionStudent>() {
+ public SessionStudent toEntityModel() {
+ return _nullSessionStudent;
+ }
+ };
+}
\ No newline at end of file