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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:23:21+00:00 2026-05-13T15:23:21+00:00

I’m using hibernate with mySQL and I’ve the following problem: I do a nativeSQL

  • 0

I’m using hibernate with mySQL and I’ve the following problem: I do a nativeSQL query on a table with, among others, a column that is a character long. This column can get to null. Now I receive the following exception while querying:

4-feb-2010 10.31.00 org.hibernate.type.NullableType nullSafeGet
INFO: could not read column value from result set: nazeuro; String index out of range: 0
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.charAt(String.java:686)
        at org.hibernate.type.CharacterType.get(CharacterType.java:29)
        at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
        at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:189)
        at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.extract(CustomLoader.java:474)
        at org.hibernate.loader.custom.CustomLoader$ResultRowProcessor.buildResultRow(CustomLoader.java:420)
        at org.hibernate.loader.custom.CustomLoader.getResultColumnOrRow(CustomLoader.java:317)
        at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:606)
        at org.hibernate.loader.Loader.doQuery(Loader.java:701)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
        at org.hibernate.loader.Loader.doList(Loader.java:2220)
        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)
        at Views.Components.QuickLookup$updater.run(QuickLookup.java:102)

I’ve been googling to solve the issue, I even found posts here on SO, but everytime it is about mapping to objects and writing custom classes to handle the issue. In this situation what I need is a Object array. I know a solution could be to change the table but I’d avoid it as I’ve to work with a pre-existing db. So do you have any possible solutions?


SQLQuery query = sess.createSQLQuery("SELECT * from " + table + " WHERE " + filter + " LIKE '" + search + "%'");
                    System.out.println(query.toString());
                    List<Object[]> result = query.list();
  • 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-13T15:23:21+00:00Added an answer on May 13, 2026 at 3:23 pm

    Which Hibernate version are you using? In 3.3.2, this is CharacterType.get():

    public Object get(ResultSet rs, String name) throws SQLException {
        String str = rs.getString(name);
        if (str==null) {
            return null;
        }
        else {
            return new Character( str.charAt(0) );
        }
    }
    

    In case this wasn’t obvious, the exception indicates that you got an empty, non-null string ("") from the result set, which causes CharacterType to barf, as this is not an expected value for a CHAR(1). (This is a CHAR(1) column, is it?)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a

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.