Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF Design Questions

 
Venkatesh Kumar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All:

We are building an application using JSF,Hibernate,and EJB3 and would like to implement the best practices out there in our project.Following are some design related qts.

We have two screens Create Order and View Order.As the names indicate Create Order screen lets the user place an order and View Order screen lets the admin view the orders.View Order screen has some actions/functionality specific to the admin.Should we use the same backing bean for both the screens or separate it out by having a OrderBean,and extending OrderBean to have CreateOrderBean and EditOrderBean.???

Is it a good practice to use the ORM objects in the JSF pages directly?Would it lead to tight coupling b/w the UI layer the and the DB layer.(Scenario:When the admin searches for the orders we iterate through the order objects and display them in a table).

Thank you for your responses.
 
Andres Quinones
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most of the cases implementing JSF you will find that they create one JSF Managed Bean per page. This make for some other developers to understand better the code. What probably you can do is to centralize all the Queries for the Orders in an OrderBean (EJB).

For the ORM Object, when you use JSF and Hibernate I think that the connection to the Database is closed after you return the objects to the View. Taking this in account probably is better that you update always the DB with the data captured from the view Layer and don't let it to modify it directly from the view through the ORM objects. It is possible but I don't think that could be a good practice.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic