| Author |
Problem retrieving data from relational databse using persistence
|
jsfnewbiez noob
Greenhorn
Joined: Jun 29, 2012
Posts: 1
|
|
Hi. I'm newbie here and also in jsf.
Recently, I have problem with my login page. I have database with table customer. What I want to do is when user enter username and password, it will go to another page. But, the problem is how to retrieve data from database. I have created persistence, but I still cant find the way how to retrieve data from database. Can someone help me? I'm using netbean for jsf.
This is the code generated by netbean when I choose "Entity Classes From Databse".
Just say I want to retrieve only one customer name. Can I simply write <h utputText value="#{Customer.name}"> like this?
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14571
|
|
We don't have many rules here at the JavaRanch, but we do insist that you use your Real Name and not some sort of "handle" or obvious alias. If you're not sure about this, see
http://www.javaranch.com/name.jsp .
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
caleb momanyi
Ranch Hand
Joined: Jun 17, 2012
Posts: 43
|
|
after you create your entity classes eg Customer.java, you need to create session beans for the entity classes in another package say session classes. they have your entity class name and Facade suffix eg CustomerFacade.java
then in your servlet you reference the session beans with the annotation eg
@EJB
CustomerFacade customerFacade;
then in the method where you want to get the username and password you can use JPQL which is a query language for JPA this is where i am stuck too
|
 |
 |
|
|
subject: Problem retrieving data from relational databse using persistence
|
|
|