Listing 4. BookPK.java, the Primary Key Class for Our Entity Bean
package il.co.lerner.book;
import java.io.Serializable;
public class BookPK implements java.io.Serializable
{
public int id;
public BookPK () { }
public BookPK(int value)
{
id = value;
}
public boolean equals(Object obj)
{
if (obj == null || !(obj instanceof BookPK))
return false;
if (((BookPK)obj).id == id)
return true;
return false;
}
public int hashCode ()
{
return id;
}
public String toString()
{
return String.valueOf(id);
}
}
Copyright © 1994 - 2019 Linux Journal. All rights reserved.