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

📄 entriesdelegate.java

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

package org.helpsoft.blog.j2ee.delegate;

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

public class EntriesDelegate implements EntriesDao
{
	private EntriesSession session;

	/**
	 * Method 'EntriesDelegate'
	 * 
	 * @param session
	 */
	public EntriesDelegate(final EntriesSession session)
	{
		this.session = session;
	}

	/** 
	 * Inserts a new row in the entries table.
	 */
	public EntriesPk insert(Entries dto) throws EntriesDaoException
	{
		try {
			return session.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 {
			session.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 {
			session.delete(pk);
		}
		catch (EntriesDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new EntriesDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findAll'
	 * 
	 * @throws EntriesDaoException
	 * @return Entries[]
	 */
	public Entries[] findAll() throws EntriesDaoException
	{
		try {
			return session.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 session.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 session.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 session.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 session.findWhereDateEquals(date);
		}
		catch (EntriesDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new EntriesDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findByPrimaryKey'
	 * 
	 * @param pk
	 * @throws EntriesDaoException
	 * @return Entries
	 */
	public Entries findByPrimaryKey(EntriesPk pk) throws EntriesDaoException
	{
		try {
			return session.findByPrimaryKey(pk);
		}
		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 session.findByPrimaryKey(entryid);
		}
		catch (EntriesDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new EntriesDaoException( ex.getMessage() );
		}
		
	}

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

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

}

⌨️ 快捷键说明

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