I am working on an EJB project with OpenEJB (TomEE++) container. There is a session bean whose JNDI lookup name needs to be controlled in code.
@Stateless(mappedName="SlideService", name="SlideService")
public class SlideService {
public Map<Category, List<SlideShow>> fetchSlideShowsBycategory() {
// TODO Auto-generated method stub
return null;
}
public SlideShow fetchSlideShow(long id) {
// TODO Auto-generated method stub
return null;
}
public List<SlideShow> fetchSlideShowsByTitle(String title) {
// TODO Auto-generated method stub
return null;
}
}
My problem is that, the name to which this bean gets bound is 'global/slides/SlideService'
OpenEJB seems to be using the application name, even though I have not specifically mentioned it.
Would this compromise portability ? Is it possible some other container may not use the application name ?
Is using name and mappedName attributes the right way to control the name of a stateless bean, or are there other(better) ways ?