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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:44:19+00:00 2026-06-03T00:44:19+00:00

I have a mapped stored procedure <sql-query name=sproc callable=true > <return alias=suppliers class=model.Supplier> <return-property

  • 0

I have a mapped stored procedure

<sql-query name="sproc" callable="true" >
    <return alias="suppliers" class="model.Supplier">
        <return-property name="name" column="CoName" />
    </return>
    { call sproc(:p1,:p2,:p3}
</sql-query>

When executed as a named query and the stored procedure returns results then query.list() will return the expected results but when the stored procedure returns no results I get a NPE when Hibernate is trying to initialize the entity to return.

I could catch the npe and return an empty list but that’s not great, is there anything else I can do?

  • 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-03T00:44:20+00:00Added an answer on June 3, 2026 at 12:44 am

    According to this hibernate docs the mssql stored procedure must return a result set. Further in section 16.2.2.1 it states you can use session.connection(). But I don’t think that will be of much use. Hence handling the null pointer seems a good way.

    EDIT :

    If you are using session.connection(), you can also return the @@ROWCOUNT if the output is the only thing that is being used in the procedure to get the number of rows changed. 0 indicating nothing being returned

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

Sidebar

Related Questions

I have a stored proc mapped as follows in NHibernate: <sql-query name=HistoricSearch> <return class=ResultItem>
I have model class CreatedMixin(object): __abstract__ = True @declared_attr def created_by(cls): return Column(Integer, ForeignKey('user.user_id',
I have a stored procedure that I've mapped in my entity framework model (trying
I have an entity mapped as following: @Entity @Table(name = Groups) @IdClass(value = GroupId.class)
I have a stored procedure that returns a scalar value, I mapped it in
I have a SQL Server 2008 stored procedure (pseudocode below) that goes as follows:
I have a native query that executes a stored procedure and the results is
I have a class mapped with a table, in my case in a declarative
I have fetched 3-4 tables by executing my stored procedure. Now they resides on
I have a stored procedure in Oracle that returns result set(s) via OUT parameter(s)

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.