This is a difficult question to answer as it is subjective and conditional upon so many conditions. While using a JavaBean proxy implementation hides much of the mechanics of using an EJB, you need to balance this with the usage.
JNDI lookups are expensive and this can degrade your application performance if your proxy performs this lookup on every invocation. Caching the lookup brings performance benefits but introduces complexities that may impact the ability to use your JavaBean.
From the perspective of generalised result access, the use of collections reduce the number of specialized methods -> returns and can minimize maintenance.
YMMV. Patterns are useful but only if you can assess all the forces and environmental conditions to which your solution will be subjected, and determine the best pattern combination for the conditions.
but i could do a lookup on the stateless session bean in de init method of the servlet, right ? And just create a instance of the session bean on the home object on every method invociation (not meaning it actually will be created) !!??
I don't like the javabean wrappers actually, because it will take time to create them. I'm wondering what would be the best approach in your opinion.
You could also use struts and perform the lookup's in the action Object. This seems a good approach, if you want to keep your jsp's simple.
But javabeans are keeping the jsp's simple too, but it takes more work to develop them.
Giving a Vector back at all times, is keeping my jsp's simple too, because people who are designing the jsp's just have to include the jsp, which is giving back the results's.
But giving back a Vector, where you know that there will be just one object in it at all times, seems a bit strange. Besides giving back a String should be easer to marshal trough to stubs and skeleton's ??
Yes. Using the init or jspInit caches the home reference you have looked up. This is the usual approach for servlets and JSPs. However, it does suffer from a problem when the EJB is redeployed as the reference is no longer valid. You will also need to perform some sort of caching of the CMP bean home reference used by the session bean if you want to improve the efficiency there.
Using a collection means that should the function mutate and it may be possible to return more than one value, that there is minimal (no changes) to the client code. The downside is iterating through a collection. As I said, YMMV and only the designer can make decisions on this. Performance might be better with transporting only a String but usage will determine the actual performance impact. As with everything, it is a matter of tradeoffs dependent on your situation.
Hope that helps.