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

📄 operationbean.java

📁 jboss4 + Mysql +ejb3.0 EJB3 简单例子
💻 JAVA
字号:
/**
 * Copyright (c)上海烟草(集团)公司与上海康时信息系统有限公司。
 */
package com.myejb.imp;

import javax.ejb.Local;
import javax.ejb.Remote;
import javax.ejb.Stateless;

import org.jboss.annotation.ejb.LocalBinding;
import org.jboss.annotation.ejb.RemoteBinding;

import com.myejb.LocalOperation;
import com.myejb.Operation;

/**
 * 实现了远程和本地的会话Bean
 * @author xywang
 * @since 2009-2-11
 * @version 1.0
 */
@Stateless
@Remote({Operation.class})
@RemoteBinding(jndiBinding="myejb/RemoteOperation") // 自己定义jndi名字
@Local({LocalOperation.class})
@LocalBinding(jndiBinding="myejb/LocalOperation")
public class OperationBean implements Operation,LocalOperation{
    private int total = 0;
    private int addresult = 0;
    /* (非 Javadoc)
     * @see com.myejb.Operation#Add(int, int)
     */
    public int Add(int a,int b){
        addresult = a + b;
        return addresult;
    }

    /* (非 Javadoc)
     * @see com.myejb.LocalOperation#getResult()
     */
    public int getResult(){
        total += addresult;
        return total;
    }

}

⌨️ 快捷键说明

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