Is it true that we cannot use Composite Primary key when we opt for EJB 1.1 & Weblogic 5.1 as the development platform. If it is possible would anyone help in providing some direction to achieve my goal in developing a system, my database system would be on SQL.
Murali Thantry
-
Composite Primary Key in EJB 1.1 & Weblogic 5.1 (1 messages)
- Posted by: Murali Thantry
- Posted on: March 26 2001 05:54 EST
Threaded Messages (1)
- Composite Primary Key in EJB 1.1 & Weblogic 5.1 by Somil Nanda on March 26 2001 17:09 EST
-
Composite Primary Key in EJB 1.1 & Weblogic 5.1[ Go to top ]
- Posted by: Somil Nanda
- Posted on: March 26 2001 17:09 EST
- in response to Murali Thantry
It is possible to have a composite key in weblogic 5.1
here is an example
package com.whatever.whatever
import java.io.Serializable;
public class CompositePK implements java.io.Serializable {
public int firstID;
public int secondID;
public CompositePK(){}
public CompositePK( int firstID, int secondID ){
this.firstID = firstID;
this.secondID = secondID;
}
public boolean equals(Object obj){
if (obj == null || !(obj instanceof CompositePK))
return false;
else if ( (((CompositePK)obj).firstID == firstID) &&
(((CompositePK)obj).secondID == secondID) )
return true;
else
return false;
}
public int hashCode(){
return toString().hashCode();
}
public String toString(){
return firstID+""+secondID;
}
}