-
1. Re: Retrieving data from database
kruno Jun 23, 2007 9:02 AM (in response to alexrozario)Please post the source.
-
2. Re: Retrieving data from database
alexrozario Jun 25, 2007 3:07 AM (in response to alexrozario)hi kruno,
thank you for your response..
i found that its not an database error.
i can retrieve data from table..
but the problem is in viewing..
how to view(display) that details in my view page..
i am using facelet file to view that data.
and this is my session bean class which retrieving data
@Stateless
@Name("searchsession")
public class SearchSession implements SearchLocal
{
@Out
private List details;
public String search()
{
details =em.createQuery("select s.storeName,s.reviewPoints,s.website from Stores s").getResultList();
System.out.println("list : "+details);
return "query";
}
}
and my facelet file contains,
<rich:dataTable width="483" id="details" rows="10" columnClasses="col" value="#{details}" var="val">
<h:column>
<h:outputText value="#{val.storeName}" />
</h:column>
<h:column>
<h:outputText value="#{val.reviewpoints}" />
</h:column>
<h:column>
<h:outputText value="#{val.website}" />
</h:column>
</rich:dataTable>
now help me to view them in my facelet file..
thank you -
3. Re: Retrieving data from database
kruno Jun 26, 2007 4:08 AM (in response to alexrozario)Select seems to be the problem em.createQuery("select s.storeName,s.reviewPoints,s.website from Stores s").getResultList();
this way you will get String [] in side private List details;
you need to get list of object Stores,
try this: em.createQuery("from Stores s").getResultList(); -
4. Re: Retrieving data from database
alexrozario Jun 28, 2007 12:54 AM (in response to alexrozario)"alexrozario" wrote:
how to view(display) that details in my view page..
i am using facelet file to view that data.
and this is my session bean class which retrieving data@Stateless @Name("searchsession") public class SearchSession implements SearchLocal { @Out private List details; public String search() { details =em.createQuery("select s.storeName,s.reviewPoints,s.website from Stores s").getResultList(); System.out.println("list : "+details); return "query"; } }
and my facelet file contains,<rich:dataTable width="483" id="details" rows="10" columnClasses="col" value="#{details}" var="val"> <h:column> <h:outputText value="#{val.storeName}" /> </h:column> <h:column> <h:outputText value="#{val.reviewpoints}" /> </h:column> <h:column> <h:outputText value="#{val.website}" /> </h:column> </rich:dataTable>
now help me to view them in my facelet file..
thank you -
5. Re: Retrieving data from database
alexrozario Jun 28, 2007 12:56 AM (in response to alexrozario)i am trying your suggestion too kruno..
but cant finish it off. still i am facing the same issue.
help me to overcome this issue