Design Generic CRUD Session Bean

后端 未结 2 511
臣服心动
臣服心动 2021-01-03 09:44

This question has been asked once here EJB 3 Session Bean Design for Simple CRUD, and I just want to ask more in depth questions about this design. I already tried to ask th

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-03 09:58

    1.- Your stateless bean is exposing the interface GenericCrudService (the view is what the application server registers), for that reason you use

    @EJB
    private GenericCrudService myEJB;
    

    If you have multiple implementations of this interface, you can add the ejb name to the annotation for disambiguation:

    @EJB(name="GenericCrudServiceBean")
    private GenericCrudService myEJB;
    

    In EJB 3.1, Session Bean without interface are exposing something called a No-Interface View. These session beans can be used only locally.

提交回复
热议问题