on 11-19-2008 1:18 PM
Hi Everybody
I am going to redesign a moderate size application (not v big but larger then normal).
Now I have few Question in my mind.
I am using JSF as front-end, EJB3 Session Bean for Business Logic and last but not the least JPA as domain model.
1 - With JPA we have a domain classes. Now its better to use entity as manage-bean for JSF or manage bean should be saperate.
2 - Using DTO (Data Transfer Object) is good practice or not in JEE5.
3 - Simplicity or Complexity but with EntityManager I feel no need of DAO but I am used to with DAO pattern. So again as best practice I have to make 1 session bean as DAO and call it from all the session bean where I write business logic or forget about DAO session bean and call EntityManager from all session bean everywhere.
4 - For initializing EJB JNDI is 1 way other way is
@EJB EJBCLASSNAME ejbclassobject; //this auto initialize and create object.
Initializing like above is standard or it is an extended support from some app server.
Hi Syed ,
I would like to answer 2 of your questions
2 . Using DTO : in EJB 3.0 as Entity is POJO , you can use it as DTO , but its not good practice as you are exposing your Entity objects. So better to use DTO
4. Yes. This is standard way of JNDI in EJB3.0
@EJB
SessionBean sessionBeabObject;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Follow my opinion:
1 - With JPA we have a domain classes. Now its better to use entity as manage-bean for JSF or manage bean should be saparated.
>> I think that Managed-Bean must be separated, because you can need to bind you Visual Components to it too.
2 - Using DTO (Data Transfer Object) is good practice or not in JEE5.
>> You can put your Entity as a member of you Managed Bean.
3 - Simplicity or Complexity but with EntityManager I feel no need of DAO but I am used to with DAO pattern. So again as best practice I have to make 1 session bean as DAO and call it from all the session bean where I write business logic or forget about DAO session bean and call EntityManager from all session bean everywhere.
>> For CRUD operation I don't create a additional class, but for complex business logic, you can use a separated class (Business Manager)
Best regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.