wood burning stoves 2.0*
The moose likes JSF and the fly likes Problem retrieving data from relational databse using persistence Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem retrieving data from relational databse using persistence" Watch "Problem retrieving data from relational databse using persistence" New topic
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 <hutputText value="#{Customer.name}"> like this?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem retrieving data from relational databse using persistence
 
Similar Threads
uses a non-entity as target entity in relationship attribute
problem with hibernate and struts
OneToMany <-> ManyToOne relationship
Error when deploying an EAR on JBoss 5.1.0
Hibernate @Embeddable Annotation