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 6709039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:49:58+00:00 2026-05-26T07:49:58+00:00

I am trying to get data from LivEx table as list, and then save

  • 0

I am trying to get data from LivEx table as list, and then save that data into two dimensional array called array. My method is returning object[][].

I made up this code from googling here and there and taking bits from every example, however I am doing something wrong which I can’t quite seem to put my finger on. It gives me an exception which is a NullPointerException whenever I call getLivExList(currentPlan).

Here is my code:

public static Object[][] getLivExList(String currentPlan) throws Exception {
    Session s = null;

    try {
        s = HibernateUtil.getSessionFactory().getCurrentSession();
        s.beginTransaction();
        String query = "select F.item, F.category, F.amount from LivEx F where F.planName=?";
        Query q = s.createQuery(query);
        System.out.println(query);
        List fp = q.list();
        s.getTransaction().commit();
        Object array[][] = new Object[fp.size()][3];
        for (int i = 0; i < fp.size(); i++) {
            for (int j = 0; j < 3; j++) {
                array[i][j] = fp.get(j +(3 * i));
            }
        }
         System.out.println("getLivExdata in networthentitymanager OKAY");
        return array;
    } catch (Exception e) {
         System.out.println("problem at getLivExdata in networthentitymanager");
         throw e;
    } finally {
        if (s != null) {
            HibernateUtil.closeSession();
        }
    }

Please help me find out where the problem is coming from.

This is the exception I am getting:

    SEVERE: null
    org.hibernate.QueryException: Expected positional parameter count: 1, actual parameters: [] [select F.item, F.category, F.amount from LivEx F where F.planName=?]
    0 problem 
    at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:319)
    at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:275)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:75)
    at com.elitconsultancy.finplanner.entity.NetWorthEntityManager.getLivExList(NetWorthEntityManager.java:213)
  • 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-26T07:49:59+00:00Added an answer on May 26, 2026 at 7:49 am

    You’re not setting the plan name for the query, even ‘though you’ve specified a positional parameter (?).

    Put this before your call to list:

    query.setString(0, currentPlan);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get data from my sql server data table to a
What is the best way of handling trying to get data from a DataReader
I'm trying to get character data from www.wowarmory.com using PHP and cURL. The code
for example I'm trying to get the data from database like: using (ExplorerDataContext context
I have sugar crm instance and i was trying to get some data from
I'm trying to get the video data from this youtube playlist feed and add
I am trying to get some form data from POST method. Here's the code
I'm trying to use jQuery to get data from an ASP.NET web service (SharePoint
I am trying to rewrite an url with GET-data from a form. This works
Im trying to get a completly data copy from a gridview, itryed clone(), tryed

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.