This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.

Less than 42 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!

Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF + JPA how to use together  RSS feed

Ramil Huseynov
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to do simple impute on JSF

<h:inputText value="#{}"/>
<h:inputText value="#{person.lastname}"/>
<h:commandButton value="ok" action="submit"/>

but a little bit confused. JSF use managed bean. JPA use EntityBean. how to bind them, or use one class as Entity and Managed bean at the same time?
I red about DAO(Data access object), about injection, session beans, but did not understand how to use them in action. Can you give me a link to tutorial, where input used. All tutorials work with full database, and only read from database, but i need insert data.
Tim Holloway
Posts: 18531
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Ramil!

I was scratching my head over what you meant by "doing a simple impute", but then I realized you meant "input". "Impute" is a valid English word, although not that much used except maybe by lawyers these days.

It is not recommended to try and use Domain Model (JPA) objects directly as JSF backing beans or injected into JSF backing beans. The JSF auto-wiring mechanism isn't designed to work with multiple instances of objects where the instance being wired changes over time. So normally you use a JSF MVC Model object (backing bean) as a fa├žade and access the Domain Model object through the backing bean's properties.

It's common practice to inject or construct a persistence interface object such as an EJB session bean or a DAO into a JSF backing bean. You would then use this access object to read and update the database data.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!