Hi:
I have been puzzle by this.
In my function of "findByPrimaryKey" is to select some data with the given primarykey and return it.
Suppose I have create a BMP entity bean with primarykey equal with "AAA". Does the Container just retrieve the exist object with primary key equal with "AAA" or create a new one if I call findByPrimaryKey("AAA").
Thanks!
John Lee
-
Can findByPrimaryKey find exist one in BMP entity bean. (1 messages)
- Posted by: John Lee
- Posted on: October 31 2002 22:54 EST
Threaded Messages (1)
- Can findByPrimaryKey find exist one in BMP entity bean. by Dion Almaer on November 01 2002 06:25 EST
-
Can findByPrimaryKey find exist one in BMP entity bean.[ Go to top ]
- Posted by: Dion Almaer
- Posted on: November 01 2002 06:25 EST
- in response to John Lee
In BMP, your job in the bean class is to implement:
YourPK ejbFindByPrimaryKey(YourPK pk);
This normally means, that you take the pk, do a select on the database where yourpk=?. If the db finds a row, you can simply return pk;, else throw new ObjectNotFoundException(...).
The container then takes that primary key, wraps it up in a remote stub which gets sent back to the "client" (whoever called home.findByPrimaryKey(YourPK);