Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

PK Class Problem

GladeGlade Member Posts: 48
[b][red]This message was edited by Glade at 2005-1-6 4:6:58[/red][/b][hr]
Hi, I built this entity bean and it deployed successfully on JBoss. I'm having a problem with the findByPrimaryKey() method. When i try to access it through the client program, i get this following error msg from the Tomcat server :

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.ServerException: removing bean lock and it has tx set!; nested exception is:
java.lang.IllegalStateException: removing bean lock and it has tx set!.....

Here's the code of my PK Class

package flight;

public class FlightPK implements java.io.Serializable {
public String flightNumber = "";
public String airline = "";

public FlightPK() { }

public FlightPK(String flightNumber, String airline) {
this.flightNumber = flightNumber;
this.airline = airline;
}

public boolean equals (Object obj) {

if (obj == null | !(obj instanceof FlightPK))
return false;
else if (((FlightPK) obj).flightNumber == flightNumber && ((FlightPK) obj).airline == airline)
return true;

return false;

}

public int hashCode() {return (flightNumber + airline).hashCode();}

public String toString() { return (flightNumber + airline).toString();
}


}

and, if it helps, here's how i called the method from the client program:

Flight f = home.findByPrimaryKey(new FlightPK(flightnumber, airline));

As you can see, i have to use two primary keys instead of one...i think that's where i screwed up. Any ideas please?!

Thanks for your time,
Glade


Sign In or Register to comment.