JSF + JPA non-EJB best practice


Web tier: servlets, JSP, Web frameworks: JSF + JPA non-EJB best practice

  1. JSF + JPA non-EJB best practice (4 messages)

    This seems like a pretty basic question but I've done a LOT of research and haven't found this niche discussed. The tutorials, of which there are MANY are all pretty basic. One step up from that is full on EJB 3.0 stuff. I am stuck in the middle and am having trouble deciding on the "right" architecture. The real goal of my effort is to learn JSF. To do that, I am starting new development on a small web site. No EJB or anything fancy. It will use MySQL as a data store and I've generated all the DAOs in eclipse. The thing I'm struggling with is how to control everything. I'm thinking of using a managed session bean and having it instantiate the objects as needed. But even that is not as straight forward as I'd like. The generated objects need to call the DAO (em) methods to actually get the data. Which sadly gets us not much closer to actually populating their attributes. So I could end up with something like #{sessionBean.Customer.getDAO.lastName}. This would probably work, but it certainly doesn't smell like a best practice. And creating a dozen (or more) managed objects through faces-config surely can't be the way the tools are supposed to be used. It seems like people probably figured this all out a long time ago. I'm sure after the third or forth time I throw it all out and restart I'll figure out the "right" way. But I am hoping someone can offer me some quick wisdom on how to architect this environment.
  2. I have completed an ICEfaces tutorial covering lazy loading a paginated dataTable with JPA outside an EJB3 container (Tomcat). Updates are pushed out from the server using the ICEfaces rendering api. If you are doing something table intensive, the application should meet your basic requirements. The tutorial should be published to icefaces.org in the near future. http://anonsvn.icefaces.org/repo/tutorials/trunk/tutorials/samples/dataTable-JPA. Brad Kroeger
  3. Thanks, that's not exactly what I was hoping for, but IceFaces is on my list too. So I'll check it out. BTW, that tutorial doesn't render in Firefox, on IE Bad form guys!!!
  4. The tutorial renders just fine for me in Firefox. In fact the screen grab in the instructional html page is from Firefox. Brad
  5. That's very strange. When I try to bring up the tutorial it doesn't render at all - firefox just dumps the raw html to the window. I have had this problem before on very rare occasions and always just figured the site was pandering to some IE bug. Doing the most cursory of examinations, this very page we're on now has no meta data other than the simple DOCTYPE. The tutorial page has the exact same DOCTYPE and both pages are missing a Content-Type meta tag. One of my suspecions had been that a missing Content-Type was what caused Firefox to have problems. But as I said since I've only had the problem maybe 5 times ever, I never really cared enough to investigate. I tried running total validator on the this page and it has numerous warnings but nothing too serious. On the tutorial it says the page is not valid: [the page] is not an (x)html page. The page must be of type 'text/html' or 'application/xhtml+xml' Which of course looks like our friend Content-Type again. Still, the open/close of html, head, and body are all there in the right places. So total validator's flat refusal to parse is quite unexpected. Very curious. But sadly far from the most important thing going on today.