This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
This is a general question about best practices for handling persisted data in JSF. My JSF page is going to have several fields that map to a managed bean. Upon a button click the fields of this bean are going to be persisted in a database. Is it better to use another bean with application scope to handle the JDBC code, or should I have a method in the bean itself to handle that? Similarly I'll need a method to retrieve the information upon a user request.
JSF UI Model objects (backing beans) should generally not also be ORM Persistence Model objects. That's because backing beans are normally singleton instances. JSF doesn't have any internal persistency or ORM locator functionality, so it's difficult to bind a non-unique ORM Model object (database table row) into the JSF UI.
What I normally do to get around that is make a distinct UI backing bean which contains a property named "data", which is the ORM instance that I'm dealing with. That allows the backing bean to interface with the ORM's finder and persistency functions (DAO, for example), plus it allows me a place to keep JSF's UI support properties and related methods.
An IDE is no substitute for an Intelligent Developer.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com