• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

JSF(managed) beans, can not work with JPA

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi folks, I'm new in JSF
I developed a JSF application,
application is about a small library
okay, admin users can add new book to system(DB)
I do it with a method in a managed bean, but
some problems are here
codes
the bookAdd.jsp page (it's Okay)


and related managed bean (the problem specify with [x])

everything works okay, except addBook() method, id doesn't add any new record with JPA, or throws any exception, also it works till [x]
[0]:record(s) can not add to DB
[1]:this operation doesn't work(process)
*without any new record(s) or changes in database
*web server doesn't throw any exception

please help!
 
Saloon Keeper
Posts: 24857
174
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My guess is that your transaction commit process isn't correct, but I don't do anything that's remotely like what you're doing.

First of all, I'm using DTO/Service classes to handle the persistence rather than attempting to jam everything into the backing bean.

Secondly, I use Spring to manage the DTO/Service instances. Spring can automatically provide the transaction management as well as the grunt work of cleaning up exceptions and stuff like that. And Spring and JSF play together quite well.

While I use more classes to get the work done, the individual classes are all simpler, since they only attempt to accomplish one thing, and they're enough like related classes in the same tier that it makes for easier maintenance and testing.
 
Jason Marlyn
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
wow, i solved it,
I just change my provider "OpenJPA" and use

instead of

and it works Okay
also thank you Mr. Holloway, I'd like to see an example of your solution
thanks anyway
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic