⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 entriessessionbean.java

📁 JAVA 经典案例 源代码 Part2.
💻 JAVA
字号:
/*
 * 
 * 开发时间:2004-08-20 at 05:40:07
 * 
 * 作者:曹广鑫
 * 
 * 网站:www.helpsoft.org  电子邮件:support@helpsoft.org
 */

package org.helpsoft.blog.j2ee.session;

import org.helpsoft.blog.factory.*;
import org.helpsoft.blog.dao.*;
import org.helpsoft.blog.dto.*;
import org.helpsoft.blog.exceptions.*;
import java.rmi.RemoteException;
import java.math.*;
import java.util.Date;
import javax.ejb.*;

public class EntriesSessionBean implements SessionBean
{
	private EntriesDao daoImpl = createDao();

	/** 
	 * Inserts a new row in the entries table.
	 */
	public EntriesPk insert(Entries dto) throws EntriesDaoException
	{
		try {
			return daoImpl.insert(dto);
		}
		catch (EntriesDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new EntriesDaoException( ex.getMessage() );
		}
		
	}

	/** 
	 * Updates a single row in the entries table.
	 */
	public void update(EntriesPk pk, Entries dto) throws EntriesDaoException
	{
		try {
			daoImpl.update(pk, dto);
		}
		catch (EntriesDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new EntriesDaoException( ex.getMessage() );
		}
		
	}

	/** 
	 * Deletes a single row in the entries table.
	 */
	public void delete(EntriesPk pk) throws EntriesDaoException
	{
		try {
			daoImpl.delete(pk);
		}
		catch (EntriesDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new EntriesDaoException( ex.getMessage() );
		}
		
	}

	/** 
	 * Returns the rows from the entries table that matches the specified primary-key value.
	 */
	public Entries findByPrimaryKey(EntriesPk pk) throws EntriesDaoException
	{
		return findByPrimaryKey( pk.getEntryid() );
	}

	/**
	 * Method 'findAll'
	 * 
	 * @throws EntriesDaoException
	 * @return Entries[]
	 */
	public Entries[] findAll() throws EntriesDaoException
	{
		try {
			return daoImpl.findAll();
		}
		catch (EntriesDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new EntriesDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findWhereEntryidEquals'
	 * 
	 * @param entryid
	 * @throws EntriesDaoException
	 * @return Entries[]
	 */
	public Entries[] findWhereEntryidEquals(int entryid) throws EntriesDaoException
	{
		try {
			return daoImpl.findWhereEntryidEquals(entryid);
		}
		catch (EntriesDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new EntriesDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findWhereNameEquals'
	 * 
	 * @param name
	 * @throws EntriesDaoException
	 * @return Entries[]
	 */
	public Entries[] findWhereNameEquals(String name) throws EntriesDaoException
	{
		try {
			return daoImpl.findWhereNameEquals(name);
		}
		catch (EntriesDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new EntriesDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findWhereAuthorEquals'
	 * 
	 * @param author
	 * @throws EntriesDaoException
	 * @return Entries[]
	 */
	public Entries[] findWhereAuthorEquals(String author) throws EntriesDaoException
	{
		try {
			return daoImpl.findWhereAuthorEquals(author);
		}
		catch (EntriesDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new EntriesDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findWhereDateEquals'
	 * 
	 * @param date
	 * @throws EntriesDaoException
	 * @return Entries[]
	 */
	public Entries[] findWhereDateEquals(String date) throws EntriesDaoException
	{
		try {
			return daoImpl.findWhereDateEquals(date);
		}
		catch (EntriesDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new EntriesDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findByPrimaryKey'
	 * 
	 * @param entryid
	 * @throws EntriesDaoException
	 * @return Entries
	 */
	public Entries findByPrimaryKey(int entryid) throws EntriesDaoException
	{
		try {
			return daoImpl.findByPrimaryKey(entryid);
		}
		catch (EntriesDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new EntriesDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findByDynamicSelect'
	 * 
	 * @param sql
	 * @param arg
	 * @throws EntriesDaoException
	 * @return Entries[]
	 */
	public Entries[] findByDynamicSelect(String sql, Object[] arg) throws EntriesDaoException
	{
		try {
			return daoImpl.findByDynamicSelect(sql, arg);
		}
		catch (EntriesDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new EntriesDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findByDynamicWhere'
	 * 
	 * @param sql
	 * @param arg
	 * @throws EntriesDaoException
	 * @return Entries[]
	 */
	public Entries[] findByDynamicWhere(String sql, Object[] arg) throws EntriesDaoException
	{
		try {
			return daoImpl.findByDynamicWhere(sql, arg);
		}
		catch (EntriesDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new EntriesDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'ejbActivate'
	 * 
	 */
	public void ejbActivate()
	{
	}

	/**
	 * Method 'ejbPassivate'
	 * 
	 */
	public void ejbPassivate()
	{
	}

	/**
	 * Method 'ejbCreate'
	 * 
	 */
	public void ejbCreate()
	{
	}

	/**
	 * Method 'ejbRemove'
	 * 
	 */
	public void ejbRemove()
	{
	}

	/**
	 * Method 'setSessionContext'
	 * 
	 * @param ctx
	 */
	public void setSessionContext(SessionContext ctx)
	{
	}

	/**
	 * Method 'unsetSessionContext'
	 * 
	 */
	public void unsetSessionContext()
	{
	}

	/**
	 * Method 'createDao'
	 * 
	 * @return EntriesDao
	 */
	private EntriesDao createDao()
	{
		return EntriesDaoFactory.create();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -