Package cirrus.hibernate

Examples of cirrus.hibernate.Session


    public String createBookmark( String title,
                                  URL    url,
                                  String description,
                                  User   user )
    {
        Session     session = null;
        Transaction tx = null;

        try
        {
            session = _sessionFactory.openSession(  );

            BookmarkImpl bk = new BookmarkImpl( null, title, url.toString(), description, user );

            tx = session.beginTransaction(  );
            session.save( bk );
            tx.commit(  );

            return bk.getId(  );
        }
        catch ( HibernateException e )
View Full Code Here


                                String title,
                                URL    url,
                                String description )
        throws ObjectNotFoundException
    {
        Session     session = null;
        Transaction tx = null;

        try
        {
            session = _sessionFactory.openSession(  );

            BookmarkImpl bk = ( BookmarkImpl ) session.load( BookmarkImpl.class, id );
            bk.setTitle( title );
            bk.setUrl( url.toString() );
            bk.setDescription( description );

            tx = session.beginTransaction(  );
            session.update( bk );
            tx.commit(  );
        }
        catch( cirrus.hibernate.ObjectNotFoundException o )
        {
            throw new ObjectNotFoundException( "Bookmark#" + id + " not found" );
View Full Code Here

    /**
     * @see net.sf.jportlet.portlets.bookmark.BookmarkManager#deleteBookmarks(java.lang.String[])
     */
    public void deleteBookmarks( String ids[] )
    {
        Session     session = null;
        Transaction tx = null;

        try
        {
            session = _sessionFactory.openSession(  );

            tx = session.beginTransaction(  );
            for ( int i = 0; i < ids.length; i++ )
            {
                BookmarkImpl bk = ( BookmarkImpl ) session.load( BookmarkImpl.class, ids[ i ] );
                try
                {
                  session.delete( bk );
                }
                catch( ObjectDeletedException o )
                {
                  o.printStackTrace();
                }
View Full Code Here

     * @see net.sf.jportlet.portlets.bookmark.BookmarkManager#findBookmark(java.lang.String)
     */
    public Bookmark findBookmark( String id )
        throws ObjectNotFoundException
    {
        Session session = null;

        try
        {
            session = _sessionFactory.openSession(  );
            BookmarkImpl bookmark = ( BookmarkImpl ) session.load( BookmarkImpl.class, id );
           
            /*
             * Call a function so that the proxy get effectively loaded.
             * This will avoir LazyInstantiation error
             */
 
View Full Code Here

     * @see net.sf.jportlet.portlets.bookmark.BookmarkManager#findBookmarks(net.sf.jportlet.portlet.User, int, java.lang.String)
     */
    public Collection findBookmarks( User   user,
                                     int    maxsize )
    {
        Session session = null;

        try
        {
            session = _sessionFactory.openSession(  );

            String     oql;
            Collection col;
            if ( user != null )
            {
                oql = "FROM b IN CLASS " + BookmarkImpl.class.getName(  ) + " WHERE b.userId=? ORDER BY b.title";
                col = session.find( oql, user.getId(  ), Hibernate.STRING );
            }
            else
            {
                oql = "FROM b IN CLASS " + BookmarkImpl.class.getName(  ) + " WHERE b.userId IS NULL ORDER BY b.title";
                col = session.find( oql );
            }

            if ( maxsize >= 0 )
            {
                ArrayList lst = new ArrayList(  );
View Full Code Here

TOP

Related Classes of cirrus.hibernate.Session

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.