你想怎么用啊???
如果你要根据主键查询的话,你就得先给主键类设值,然后在查询里把主键类当作参数给实体Bean
如果你要根据主键查询的话,你就得先给主键类设值,然后在查询里把主键类当作参数给实体Bean
解决方案 »
- SSH整合,空指针异常求助!
- 非常气愤!!websphere 6 为什么会放弃我的第一个sessionId?
- 大家觉得.net的发展前途咋样?
- JAVA IO异常帮忙解决下(急)!!!
- 已知A类被打包在packageA中,B类被打包在PackageB中,且B类被声明为public,且有一个成员变量x被声明为protected控制方式。C类也位于
- JVM有没有输入java class文件的属性
- 怎样从taglib取值
- 和面试经验多的人学习学习,对日java
- 高手进来帮帮忙,怎样开发服务器端高效的socket程序
- 请教高手:运行客户端的异常
- 我女朋友老师布置的一道作业,要求用java实现。
- 从xml的Document获取文本,以及从文本parserDocument
!!!
setxxx();
------------------------------------------------------
我们还年轻牛奶会有的奶牛也会有的
可天天在 csdn 混这些会有吗 ??
package cpk;
import java.io.*;
public class RoleFunctionPK implements Serializable {
public Integer roleID;
public Integer functionID;
public RoleFunctionPK() {
}
public RoleFunctionPK(Integer roleID, Integer functionID) {
this.roleID = roleID;
this.functionID = functionID;
}
public boolean equals(Object obj) {
if (obj != null) {
if (this.getClass().equals(obj.getClass())) {
RoleFunctionPK that = (RoleFunctionPK) obj;
return (((this.roleID == null) && (that.roleID == null)) || (this.roleID != null && this.roleID.equals(that.roleID))) && (((this.functionID == null) && (that.functionID == null)) || (this.functionID != null && this.functionID.equals(that.functionID)));
}
}
return false;
}
public int hashCode() {
return (roleID + "" +functionID).hashCode();
}
}
我的客户端程序是用jbuilder做的,主方法如下:
public static void main(String[] args) {
RoleFunctionTestClient3 client = new RoleFunctionTestClient3();
RoleFunctionPK fpk;
fpk=new RoleFunctionPK(1,2);
client.findByPrimaryKey(fpk);}
fpk=new RoleFunctionPK(1,2);这句话总报错!
public java.lang.Integer orderid;
public java.lang.Integer inventoryid; public OrderitemPK() {
} public OrderitemPK(java.lang.Integer orderid, java.lang.Integer inventoryid) {
this.orderid = orderid;
this.inventoryid = inventoryid;
}
public boolean equals(Object obj) {
if (this.getClass().equals(obj.getClass())) {
OrderitemPK that = (OrderitemPK) obj;
return this.orderid.equals(that.orderid) && this.inventoryid.equals(that.inventoryid);
}
return false;
}
public int hashCode() {
return (orderid + "" +inventoryid).hashCode();
}用的时候:
……
OrderitemPK pk = new OrderitemPK(11,11);
……
fpk=new RoleFunctionPK(1,2)
这句话有Constructor RoleFunctionPK(int,int) not found in class cpk.RoleFunctionPK
错误!
public static void main(String[] args) {
RoleFunctionTestClient3 client = new RoleFunctionTestClient3();
RoleFunctionPK fpk;
fpk=new RoleFunctionPK(new Integer(1),new Integer(2));
client.findByPrimaryKey(fpk);}
应该是:
OrderitemPK pk = new OrderitemPK(new Integer(11),new Integer(11));