• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

i can't persist object using jsf managedBean

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am developing a web application using spring and JSF framework. In that i using entity class. In ManagedBean class i want to insert the data using entitymanager (JPA) persist method. But it will not working. And don't show any errors. give me the suitable methode to insert data into the database using EntityManager.Persist() method.
Thank you
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Have a look at here, and here

Hope they will give you an idea.
 
simo sevmeek
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you K. Tsang , I want to inform you that I used Spring instead of EJB
 
Saloon Keeper
Posts: 27762
196
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
Welcome to the JavaRanch, Simo!

JSF has no built-in database functionality. Whatever code you would implement for a non-JSF webapp would be essentially the same database logic that you'd use in a JSF web application.

When working with Spring, there's a an EL bridge module that you can include in your faces-config.xml file. That module allows Spring beans to be referenced in EL just like JSF Managed Beans are, which means that you can inject a Spring DAO or persistence services bean into a JSF backing bean.

I do NOT recommend that you actually inject EntityManagers into JSF managed beans. Use a DAO or persistence service the way you would using a Session EJB if you were using EJB. By isolating the GUI functionality of the JSF backing beans from the persistence functions of JPA you'll have code that's easier to understand and maintain.

Spring has extensive logging capabilities so if you're having problems seeing errors, adjust the logging levels for your web application. And whatever you do, DON'T do stuff like this:
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic