001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.bookmarks.service.persistence;
016    
017    import com.liferay.portal.kernel.dao.orm.SQLQuery;
018    import com.liferay.portal.kernel.dao.orm.Session;
019    import com.liferay.portal.kernel.exception.SystemException;
020    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
021    import com.liferay.portlet.bookmarks.model.BookmarksEntry;
022    import com.liferay.portlet.bookmarks.model.impl.BookmarksEntryImpl;
023    import com.liferay.util.dao.orm.CustomSQLUtil;
024    
025    import java.util.List;
026    
027    /**
028     * @author Brian Wing Shun Chan
029     */
030    public class BookmarksEntryFinderImpl
031            extends BasePersistenceImpl<BookmarksEntry>
032            implements BookmarksEntryFinder {
033    
034            public static String FIND_BY_NO_ASSETS =
035                    BookmarksEntryFinder.class.getName() + ".findByNoAssets";
036    
037            public List<BookmarksEntry> findByNoAssets() throws SystemException {
038                    Session session = null;
039    
040                    try {
041                            session = openSession();
042    
043                            String sql = CustomSQLUtil.get(FIND_BY_NO_ASSETS);
044    
045                            SQLQuery q = session.createSQLQuery(sql);
046    
047                            q.addEntity("BookmarksEntry", BookmarksEntryImpl.class);
048    
049                            return q.list();
050                    }
051                    catch (Exception e) {
052                            throw new SystemException(e);
053                    }
054                    finally {
055                            closeSession(session);
056                    }
057            }
058    
059    }