cmp-ProductPK.java
2006-03-07 22:41
246 查看
package examples;
import java.io.Serializable;
/**
* Primary Key class for our 'Product' Container-Managed
* Entity Bean
*/
public class ProductPK implements java.io.Serializable {
/*
* Note that the primary key fields must be a
* subset of the the container-managed Bean fields.
* The fields we are marking as container-managed in
* our Bean are productID, name, desc, and basePrice.
* Therefore our PK fields need to be from that set.
*/
public String productID;
public ProductPK(String productID) {
this.productID = productID;
}
public ProductPK() {
}
public String toString() {
return productID.toString();
}
public int hashCode()
{
return productID.hashCode();
}
public boolean equals(Object prod)
{
return ((ProductPK)prod).productID.equals(productID);
}
}
import java.io.Serializable;
/**
* Primary Key class for our 'Product' Container-Managed
* Entity Bean
*/
public class ProductPK implements java.io.Serializable {
/*
* Note that the primary key fields must be a
* subset of the the container-managed Bean fields.
* The fields we are marking as container-managed in
* our Bean are productID, name, desc, and basePrice.
* Therefore our PK fields need to be from that set.
*/
public String productID;
public ProductPK(String productID) {
this.productID = productID;
}
public ProductPK() {
}
public String toString() {
return productID.toString();
}
public int hashCode()
{
return productID.hashCode();
}
public boolean equals(Object prod)
{
return ((ProductPK)prod).productID.equals(productID);
}
}
相关文章推荐
- cmp-ProductClient.java
- cmp-ProductHome.java
- cmp-Product.java
- [LeetCode]Maximum Product of Word Lengths(Java)
- LeetCode 238 -Product of Array Except Self ( JAVA )
- 三大编程语言的性能PK--Java, C/C++和Ruby
- c++和java(c#)之间的pk
- Ruby PK java
- 按值传递 pk 按址传递(Java)
- 主流Java报表软件王者争夺战:功能大PK系列之坐标轴标签显示方式
- 主流Java报表软件之王者争夺战:功能大PK系列之图表刻度标签位置
- sbt spark2.3.1 idea打包Caused by: java.lang.ClassNotFoundException: scala.Product$class
- Unable to parse template "Class" Error message: Selected class file name 'ProductServlet.java' mappe
- java里的cmp
- LeetCode 713. Subarray Product Less Than K(java)
- Maximum Product Subarray JAVA实现
- Google Code Jam Notes - Minimum Scalar Product - Java
- Ruby PK java
- 【LeetCode刷题Java版】Maximum Product Subarray
- java.lang.NumberFormatException: For input string: "productList"