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

  • Home
  • SEARCH
  • 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 4001114
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:51:54+00:00 2026-05-20T07:51:54+00:00

public List findCatalog() { Query query = getEntityManager().createQuery(SELECT pc.productCatalog, p.name, p.product FROM ProductCatalog pc

  • 0
public List findCatalog() {
    Query query = getEntityManager().createQuery("SELECT pc.productCatalog, p.name, p.product FROM ProductCatalog pc JOIN pc.products p");
    return query.getResultList();
}

Hello, with such query my application compiles okay. But when i open the page where this query is executed i get the following error:

org.apache.jasper.JasperException: java.lang.NumberFormatException: For input string: “productCatalog”

The productCatalog is my primary key, but same happens when i just include the name column

exception
org.apache.jasper.JasperException: java.lang.NumberFormatException: For input string: “name”
root cause

java.lang.NumberFormatException: For input string: “name”

If i don’t make the join in my query then the results from 1 table are printed okay.
I’m clueless for now where the problem could be, i have read Pro JPA 2 book, official java EE 6 tutorial, googled alot.
The tables design is ManyToMany. I have product table, *product_catalog* table and the binding table *product_product_catalog. I don’t have foreign keys in the binding table.
I have created the entity and facade classes with the NetBeans EclipseLink wizard.

Here is how i mapped on my ProductCatalog class many to many relationship

@ManyToMany
    @JoinTable(name = "product_product_catalog",
    joinColumns = {
        @JoinColumn(name = "product_catalog")
    },
    inverseJoinColumns = {
        @JoinColumn(name = "product")
    })
    private Collection<Product> products;

product and product_catalog are the primary keys for corresponding tables.
Now i have no idea where i could be wrong, perhaps is the mapping wrong? Though many examples which i have seen, have the same mapping implementation, but in their tables they have foreign keys, could that be an issue?
Moreover as i said if i don’t join second table, everything works well.

Here is my servlet with initializing that method getServletContext().setAttribute("productCatalog", productCatalogFacade.findCatalog());

And here is my JSP page fragment of that

<table>
            <c:forEach var="list" items="${productCatalog}" varStatus="iter">
                <tr>
                    <td>${list.productCatalog}</td>
                    <td>${list.product}</td>
                    <td>${list.name}</td>
                </tr>
            </c:forEach>
        </table>

And here is my native SQL query what i’m trying to achieve

SELECT PPC.product_product_catalog, PPC.product_catalog, PPC.product, P.name, PC.name AS  "catalog name", P.code, P.description, P.price, P.producer
FROM product_catalog PC
INNER JOIN product_product_catalog PPC ON PC.product_catalog = PPC.product_catalog
INNER JOIN product P ON P.product = PPC.product

As my last piece of code here is the output which glassfish produces when i go to that page where the query is executed:

WARNING: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.lang.NumberFormatException: For input string: "productCatalog"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Integer.parseInt(Integer.java:449)
        at java.lang.Integer.parseInt(Integer.java:499)
        at javax.el.ArrayELResolver.toInteger(ArrayELResolver.java:375)
        at javax.el.ArrayELResolver.getValue(ArrayELResolver.java:195)
        at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
        at com.sun.el.parser.AstValue.getValue(AstValue.java:116)
        at com.sun.el.parser.AstValue.getValue(AstValue.java:163)
        at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
        at org.apache.jasper.runtime.PageContextImpl.evaluateExpression(PageContextImpl.java:1007)
        at org.apache.jsp.index_jsp._jspx_meth_c_forEach_0(index_jsp.java from :206)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java from :137)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:406)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:483)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:373)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
        at java.lang.Thread.run(Thread.java:619)
  • 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-20T07:51:55+00:00Added an answer on May 20, 2026 at 7:51 am

    When you execute a request with many variables in SELECT clause, such as

    SELECT pc.productCatalog, p.name, p.product ...
    

    each row of result is returned in form of Object[], so you need to use numeric indexes to access its elements:

    <c:forEach var="list" items="${productCatalog}" varStatus="iter"><tr>
        <td>${list[0]}</td> 
        <td>${list[2]}</td>
        <td>${list[1]}</td>
    </tr></c:forEach> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public List<NDT_Equipment> GetALLRecords() { using (NDT_DB) { return (from a in NDT_DB.NDTEquipment select a);
Let's say I have the following entity: public class Store { public List<Product> Products
I have a function public List<string> UserList() { var q = from i in
public Player(string name, List<Card> cards) { this.name = name; try { this.stack.insertCards(cards);//Here is the
This works to return a list of ints: public List<Integer> GetIListImpl() { return new
private List<Date> _dates; public List<Date> Dates { get { return _dates; } set {
public class Item { ... } public class Order { public List<Item> Items ...
If I have a property: public list<String> names { get; set; } How can
I have a generic list... public List<ApprovalEventDto> ApprovalEvents The ApprovalEventDto has public class ApprovalEventDto
I have a class like this: public class myClass { public List<myOtherClass> anewlist =

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.