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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:45:59+00:00 2026-05-20T01:45:59+00:00

I unfortunately need to use ‘native’ sql queries for a portion of my project

  • 0

I unfortunately need to use ‘native’ sql queries for a portion of my project to return tuples from unmapped tables.

I have a bunch of queries which are supposed to return the same number of values per row and then go into a processing method to turn them into objects.

eg:

List<Object[]> list = ...;
List<MyBean> beans = ...;

SQLQuery qry1 = session.createSQLQuery(...);
SQLQuery qry2 = session.createSQLQuery(...);
SQLQuery qry3 = session.createSQLQuery(...);

list.addAll(qry1.list());
list.addAll(qry2.list());
list.addAll(qry3.list());

for(Object[] tuple : list)
{
    MyBean bean = new MyBean();
    bean.setSomething0(tuple[0]);
    bean.setSomething1(tuple[1]);
    bean.setSomething2(tuple[2]);
    bean.setSomething3(tuple[3]);
    beans.add(bean);
}

now, my problem is that qry3 does not have a relevent column to populate the value at the 2nd index of the tuple, but does populate the 3rd index. I need to modify it’s query so that it populates the tuple with null or "" somehow.

I’ve tried "select a, b, null, d" and "select a, b, '', d" however both of these cause an exception:

org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111
    at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
    at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)
    at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:370)
    at org.hibernate.loader.custom.CustomLoader$Metadata.getHibernateType(CustomLoader.java:559)
    at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.performDiscovery(CustomLoader.java:485)
    at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:501)
    at org.hibernate.loader.Loader.getResultSet(Loader.java:1796)
    at org.hibernate.loader.Loader.doQuery(Loader.java:674)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
    at org.hibernate.loader.Loader.doList(Loader.java:2213)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
    at org.hibernate.loader.Loader.list(Loader.java:2099)
    at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
    at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
    at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
    at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)

so how do i tell my query to skip an index in this case?

  • 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-20T01:45:59+00:00Added an answer on May 20, 2026 at 1:45 am

    You can try to cast it to the expected type:

    select a, b, cast(null as varchar), d
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to use a third party .jar lib in my application: unfortunately the
In my AppEngine project I have a need to use a certain filter as
Unfortunately, I need to do this. I'm using ELMAH for my error log. Before
I need to validate the email address of my users. Unfortunately, making a validator
I need to make some code to talk to a SOAP web service. Unfortunately
I need to debug JavaScript in Internet Explorer 7. Unfortunately, its default debugger doesn't
Unfortunately it looks like for various reasons I'm going to have to use Visual
I need to use natural sorting with a MySQL result since it currently sorts
I need to use hidden variables in my JSP for session tracking. This is
I am writing some embedded code in C and need to use the rand()

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.