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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:10:20+00:00 2026-06-03T03:10:20+00:00

Hibernate 3.6 & postgresql 9.1. Using SQLQuery how to get result array data (array

  • 0

Hibernate 3.6 & postgresql 9.1.
Using SQLQuery how to get result array data (array of Long – assistants, array of rows of “Text, Long, Timestamp” – accounts)?

    limit = 10000;
    final SQLQuery sqlQuery = getSession().createSQLQuery("SELECT id, name, ts, " +
            " array(SELECT assistant_id FROM user_assistant WHERE p_id=pr.id ORDER BY assistant_id) AS accounts," +
            " array(SELECT row(type,uid,ts) FROM user_account WHERE p_id=pr.id ORDER BY type) AS accs," +
            " FROM profile pr WHERE ts > ? ORDER BY ts LIMIT " + limit);

The most of DAO functions written with hibernate Entities & annotations.
But for a few statistics tasks easier to work with HQL or even SQL.
As opposed to pure JDBC in hibernateSQL working with arrays is not so intuitive.

JDBC could be a solution, but I haven’t found any way to get JDBC Statement from Hibernate Session or Connection.
ResultTransformer doesn’t help also, fails with:

    org.hibernate.MappingException: No Dialect mapping for JDBC type: 2003
  • 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-06-03T03:10:21+00:00Added an answer on June 3, 2026 at 3:10 am

    By referring this

    http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/querysql.html

    What you can do something like;

    session.createSQLQuery("Your custom query")
     .addScalar("field1", Hibernate.STRING)
     .addScalar("field2", Hibernate.STRING)
     .addScalar("field3", Hibernate.STRING)
    

    and then

     for(Object rows : query.list()){
        Object[] row = (Object[]) rows;
        String field1 = row[0] // contains field1
        String field2 = row[1]
        ..
        ..
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using GWT RPC & Hibernate to insert and retrieve data from MySql
I am using GWT RPC & Hibernate to insert and retrieve data from MySQL
In a Java application stack with Spring & Hibernate (JPA) in the Data Access
I am developing project using Spring , Struts2 & Hibernate . Now I want
I have legacy application using struts & ejb2.0 , hibernate v3.0 running on JBoss
We are using Weblogoic9.2.3 & DB is Oracle10.2.0.3. How can we access Hibernate SessionFactory
I'm using Hibernate & Joda Time, with support from the UserType library. I'm able
I am using spring & hibernate. my application has 3 modules. Each module has
I am currently developing my project using Spring, Sutruts2 & Hibernate. Now i want
I am using Spring & Hibernate in my application and I want to set

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.