Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4108136
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:36:44+00:00 2026-05-20T21:36:44+00:00

I have an entity with the following named query: @NamedQuery(name = findAllGarbage, query =

  • 0

I have an entity with the following named query:

@NamedQuery(name = "findAllGarbage", query = "SELECT g.filename, g.description, g.uploadDate FROM Garbage g;")

The problem is that i want to pass that result to a dataTable to render, and i recieve NumberFormatException. I dont understand why because there are no numbers anywhere.

This is how the rest of the program looks like:

-The EJB that executes the query

@Stateless(name = "ejbs/SearchEJB")
public class SearchEJB implements ISearchEJB {

@PersistenceContext
private EntityManager em;


public List<Garbage> findAllGarbage() {
    Query query = em.createNamedQuery("findAllGarbage");    
    List<Garbage> tmpGarbage = query.getResultList();
    return tmpGarbage;
}

-The part of the JSF that displays the tableData:

<p:dataTable var="garbage" value="#{resultsController.allGarbage}" paginator="true" rows="10"  
             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
             rowsPerPageTemplate="5,10,15">         

            <p:column>  
            <f:facet name="header">  
            <h:outputText value="Filename" />  
            </f:facet>  
            <h:outputText value="#{garbage.filename}" />
             </p:column> 

            <p:column>  
            <f:facet name="header">  
            <h:outputText value="Description" />  
            </f:facet>  
            <h:outputText value="#{garbage.description}" />  
             </p:column> 

            <p:column>  
            <f:facet name="header">  
            <h:outputText value="Upload date" />  
            </f:facet>  
            <h:outputText value="#{garbage.uploadDate}" /> 
             </p:column>                
    </p:dataTable> 

-The managed bean that interacts with the JSF page:

@ManagedBean
@RequestScoped
public class ResultsController {

@EJB
private ISearchEJB searchEJB;

private Garbage garbage;

public List<Garbage> getAllGarbage() {
    return searchEJB.findAllGarbage();
}

public Garbage getGarbage() {
    return garbage;
}

public void setGarbage(Garbage garbage) {
    this.garbage = garbage;
}

The error says:

WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NumberFormatException: For input string: “filename”

I dont understand what is wrong with the file name.

————————————UPDATE————————————

I changed the JSF to this, and now i dont see the error. I see tha table data but empty:

<p:dataTable var="garbage" value="#{resultsController.allGarbage}" paginator="true" rows="10"  
         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
         rowsPerPageTemplate="5,10,15">         

        <p:column>  
        <f:facet name="header">  
        <h:outputText value="Filename" />  
        </f:facet>  
        <h:outputText value="#{garbage[4]}" />
         </p:column> 

        <p:column>  
        <f:facet name="header">  
        <h:outputText value="Description" />  
        </f:facet>  
        <h:outputText value="#{garbage[3]}" />  
         </p:column> 

        <p:column>  
        <f:facet name="header">  
        <h:outputText value="Upload date" />  
        </f:facet>  
        <h:outputText value="#{garbage[6]}" /> 
         </p:column>                
</p:dataTable> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T21:36:44+00:00Added an answer on May 20, 2026 at 9:36 pm

    The problem is caused by the fact that a query such as

    SELECT g.filename, g.description, g.uploadDate FROM Garbage
    

    returns an Object[] with filename, description and uploadDate as its elements.

    If you want to access them as object properties (as you do in JSF), you need to query for the full object instead:

    SELECT g FROM Garbage g
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following HQL query and for simplicity sake lets assume the mappings
I have a simple LINQ query running on top of Entity Framework (v1) and
I have following in database (and I use them as models): Category { long
i'm using Spring-WS and have the following spring-ws-servlet.xml file. The injection of defaultURI and
I am kind of new to Entity Framework and ORMs. I have a simple
I am using Entity Framework 4.1 code first+MVC3 and the inheritence stratagy that I
When using the application/xhtml+xml Content-Type I cannot use any named HTML entities in my
I have a simple OneToMany association between 2 object Parent & Child as shown
As the title says, i am having some problems with serializing my auto generated
There's already a lot of blog posts out there about being able to hook

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.