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

📄 commandhandlerbean.java

📁 hibernate in action 源码 caveatemptor-0.9.5初学者很适合
💻 JAVA
字号:
package org.hibernate.auction.command;

import org.hibernate.auction.persistence.HibernateUtil;

import javax.ejb.*;
import java.rmi.RemoteException;

/**
 * The implementation of a generic EJB command handler.
 *
 * @author Christian Bauer <christian@hibernate.org>
 */
public class CommandHandlerBean
	implements SessionBean, CommandHandler{

	public void setSessionContext(SessionContext sessionContext)
					throws EJBException, RemoteException {}
	public void ejbRemove()
					throws EJBException, RemoteException {}
	public void ejbActivate()
					throws EJBException, RemoteException {}
	public void ejbPassivate()
					throws EJBException, RemoteException {}

	public Command executeCommand(Command command)
		throws RemoteException, CommandException {

		try {
			command.execute();
		} catch (CommandException ex) {
			// Actually, set the UserTransaction in JTA to rollback only.
			// It is possible to not catch the exception and let the
			// container set rollback when this method fails.
			HibernateUtil.rollbackTransaction();
			throw ex;
		}
		return command;
	}
}

⌨️ 快捷键说明

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