i can't understend why in all guides write to use this:
SayHiRemote sayHiRemote = InitialContext
.<SayHiHomeRemote> doLookup(SayHiHomeRemote.JNDI_GLOBAL_NAME)
.create();
sayHiRemote.hi();
Instead of just :
SayHiRemote sayHiRemote = InitialContext
.<SayHiRemote> doLookup(SayHiRemote.JNDI_GLOBAL_NAME);
sayHiRemote.hi();
What profit of "create()" method if no arguments (Stateless Session Bean) required?
Prior to EJB 3, it was not possible to directly look up a stateless session bean. There is no real benefit other than consistency with other bean types, which is why it was removed in EJB 3.
There remains a benefit for stateful session beans, because the create method is the factory method, so if you switch to EJB, you lose type-safety (cast vs create() return type) and depending on the relative speed of JNDI vs home.create(), you probably lose some performance.