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

  • Home
  • SEARCH
  • 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 921149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:49:39+00:00 2026-05-15T18:49:39+00:00

I need to call a stored procedure using JPA and found this article: http://www.oracle.com/technology/pub/articles/vasiliev-jpql.html

  • 0

I need to call a stored procedure using JPA and found this article:

http://www.oracle.com/technology/pub/articles/vasiliev-jpql.html

which explains how to use EntityManager.createNativeQuery. However, the example actually calls a function that has a return argument. I’ve tried searching for an example of calling a stored procedure that doesn’t have a return, but haven’t been able to find anything.

Can I use createNativeQuery to call a procedure? Or does the procedure need to be modified to be a function (perhaps returns a success/failure result)?

Thanks!

  • 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-15T18:49:39+00:00Added an answer on May 15, 2026 at 6:49 pm

    From the JPA wiki:

    1.4 Stored Procedures

    JPA does not have any direct support for stored procedures. Some types of stored procedures can be executed in JPA through using native queries. Native queries in JPA allow any SQL that returns nothing, or returns a database result set to be executed. The syntax to execute a stored procedure depends on the database. JPA does not support stored procedures that use OUTPUT or INOUT parameters. Some databases such as DB2, Sybase and SQL Server allow for stored procedures to return result sets. Oracle does not allow results sets to be returned, only OUTPUT parameters, but does define a CURSOR type that can be returned as an OUTPUT parameter. Oracle also supports stored functions, that can return a single value. A stored function can normally be executed using a native SQL query by selecting the function value from the Oracle DUAL table.

    Some JPA providers have extended support for stored procedures, some also support overriding any CRUD operation for an Entity with a stored procedure or custom SQL. Some JPA providers have support for CURSOR OUTPUT parameters.

    Example executing a stored procedure on Oracle

    EntityManager em = getEntityManager();
    Query query = em.createNativeQuery("BEGIN VALIDATE_EMP(P_EMP_ID=>?); END;");
    query.setParameter(1, empId);
    query.executeUpdate();
    

    So my advices would be:

    • do some experimentations (i.e. try it)
    • if required (and if possible) modify the stored procedure
    • consider provider specific extensions (as last resort)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to call a stored procedure multiple times, I'm using informix. I would
I am using Linq to SQL to call a stored procedure which runs a
I am using Entity Framework 4.1 and do sometimes need to call stored procedures.
In my application I need to call a Stored Proc Asynchronously. For this I
I need to call a stored procedure and pass arguments in from Powershell. I
I am using Java + iBatis and have a need to call an Oracle
I have an existing stored procedure in SQL Server that I need to call
I need to use a cursor to call a stored procedure that has 2
I'm trying to call an Oracle stored procedure that accepts no input parameters. However,
I am trying to call the stored procedure using C#. I am facing problem

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.