21天精通Java,这是一本英文书

源代码在线查看: locationbean.java

软件大小: 28174 K
上传用户: flp123456
关键词: Java 英文
下载地址: 免注册下载 普通下载 VIP

相关代码

				package data;
				
				import java.rmi.*;
				import java.sql.*;
				import java.util.*;
				import javax.ejb.*;
				import javax.naming.*;
				import javax.sql.*;
				
				public abstract class LocationBean implements EntityBean
				
				{
				
				    public abstract void setName(String name);
				
				    public abstract Collection getApplicants();
				    public abstract void setApplicants(Collection applicants);
				
				    public abstract Collection getJobs();
				    public abstract void setJobs(Collection jobs);
				
				    public abstract String getName ();
				
				    public abstract String getDescription ();
				
				    public abstract void setDescription (String description);
				
				    // EJB methods start here
				
				    public void ejbPostCreate (String name, String description) {}
				
				    public String ejbCreate (String name, String description) throws CreateException {
				
				/*
				        // for BMP, there was a workaround here, namely to call ejbFindByPrimaryKey
				        // under CMP, cannot call since doesn't exist.
				        // could look up own home interface ... but instead,
				        // will rely on unique primary key on RDBMS table
				        try {
				            ((LocationLocalHome)ctx.getEJBHome()).findByPrimaryKey(name);
				            throw new CreateException("Duplicate location name: "+name);
				        }
				        catch (FinderException ex) {}
				*/
				
				        setName(name);
				        setDescription(description);
				
				        return name;
				    }
				
				
				
				    public void ejbLoad(){
				    }
				
				    public void ejbStore(){
				    }
				
				    public void ejbPassivate(){
				        setName(null);
				        setDescription(null);
				    }
				
				    public void ejbActivate(){
				    }
				
				    public void ejbRemove(){
				    }
				
				    private EntityContext ctx;
				    
				    public void setEntityContext(EntityContext ctx) {
				        this.ctx = ctx;
				    }    
				
				    public void unsetEntityContext() {
				        this.ctx = null;
				    }    
				
				    private void error (String msg, Exception ex) {
				        String s = "LocationBean: "+msg + "\n" + ex;
				        System.out.println(s);
				        throw new EJBException(s,ex);
				    }
				    
				}
							

相关资源