I'm just starting to look into using the JSF framework, and I'm a little confused about how Hibernate is meant to be integrated into my code.
From what I understand, Hibernate is meant to load data from a database and make it available as Java objects (i.e. POJOs), and then save any changes in their state back to the database. So for example, you would have a "User" object (corresponding to a row of data in the database), and a "UserController" class for dealing with these User objects (i.e. loading them via the Hibernate API, creating new Users, saving changes, etc.). In other words the User object doesn't contain any calls to the Hibernate API. You do all of that in your UserController.
However, under JSF, it seems like your JSP pages need to deal with the "User" bean directly. If you have a form where you want to display the User's information, you use the User object directly. When you submit the changes, the User object is updated. i.e., the User object's setUsername() (or whatever) method is called, and it is expected that database-related calls (i.e. Hibernate API calls) will be made inside User's setUsename() method. There is no room for a UserController here!
All of this makes sense to me under Tapestry, but I am really confused about how this is meant to work under JSF.
Sorry if this is a trivial question. Coming from Rails, I'm finding the Java web world to be a surprisingly confusing mess of competing frameworks, buzzwords, and acronyms :(
|