String substaid, String lineid,String linename, BigDecimal voltagein,Integer ismaster我有的是SQLSERVER数据库,这个表中有两个主键(String substaid, String lineid),我要在其它的方法中调用findByPrimaryKey 怎么写啊  public LineinfoRemote createAll(String substaid, String lineid,
                                  String linename, BigDecimal voltagein,
                                  Integer ismaster) throws CreateException, RemoteException;  public LineinfoRemote findByPrimaryKey(LineinfoPK pk) throws FinderException,
      RemoteException;

解决方案 »

  1.   

    你先用substaid和lineid创建一个LineinfoPK对象,然后再调用findByPrimaryKey方法。
    你试试看!
      

  2.   

    刚学,还不太懂,
    这是我EJB里自动产生的public class LineinfoPK
        implements Serializable {
      public String substaid;
      public String lineid;
      public LineinfoPK() {
      }  public LineinfoPK(String substaid, String lineid) {
        this.substaid = substaid;
        this.lineid = lineid;
      }  public boolean equals(Object obj) {
        if (this == obj)
          return true;
        if (! (obj instanceof LineinfoPK))
          return false;
        LineinfoPK that = (LineinfoPK) obj;
        if (! (that.substaid == null ? this.substaid == null :
               that.substaid.equals(this.substaid)))
          return false;
        if (! (that.lineid == null ? this.lineid == null :
               that.lineid.equals(this.lineid)))
          return false;
        return true;
      }  public int hashCode() {
        int result = 17;
        result = 37 * result + this.substaid.hashCode();
        result = 37 * result + this.lineid.hashCode();
        return result;
      }
    }
      

  3.   

    这是调用的地方, 在下面这句话中有错
      LineinfoRemote ejb = Lineinfohome.findByPrimaryKey(pk);  public int deleteLineinfo(String substaid, String lineid) {
        int back = -1;
        LineinfoPK pk=new LineinfoPK(substaid,lineid);
        LineinfoRemote ejb = Lineinfohome.findByPrimaryKey(pk);
        return 0;
      }
      

  4.   

    搞定,忘加try 块 了全当散分了