Hi:
I have define a findByPrimaryKey in Home interface which reture a Business_Check interface:
public Business_Check findByPrimaryKey(String userName);
and implement it in Bean:
public String findByPrimaryKey(String userName) {
.....
return name;
}
I want to known two questions:
1. How does the EJB container can translate the returned String type to a Business_Check interface?
2. Does the Home object find the EJB object in pool thought findByPrimaryKey?
Thanks!
John Lee
-
About the mechanism of findByPrimaryKey (2 messages)
- Posted by: John Lee
- Posted on: October 31 2002 01:48 EST
Threaded Messages (2)
- About the mechanism of findByPrimaryKey by Dion Almaer on October 31 2002 07:00 EST
- About the mechanism of findByPrimaryKey by John Lee on October 31 2002 07:48 EST
-
About the mechanism of findByPrimaryKey[ Go to top ]
- Posted by: Dion Almaer
- Posted on: October 31 2002 07:00 EST
- in response to John Lee
Hi John -
In general with a BMP entity the situation is this:
MyHome.java:
MyRemote findByPrimaryKey(MyPK pk);
MyBean.java:
MyPK ejbFindByPrimaryKey(MyPK pk) {
// make sure that the primary key exists in the db
// and return it
}
So, in the bean you have an ejbFindByPrimaryKey and in the home you have findByPrimaryKey.
The beans job is to just return the primary key, the container will then take that, and wrap it up in a remote stub which will be sent back to the client (since the client called MyRemote remote = home.findByPrimaryKey(MyPK pk).
Of course, your primary key class can be a String (like you have in your code). You need to make sure that you make the method ejbFindByPrimaryKey instead of what you have currently.
Cheers,
Dion -
About the mechanism of findByPrimaryKey[ Go to top ]
- Posted by: John Lee
- Posted on: October 31 2002 07:48 EST
- in response to Dion Almaer
Dion, Very thanks!
John Lee