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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:50:12+00:00 2026-06-04T04:50:12+00:00

THere is a oracle query that I am trying to recreate using OpenJPA. I

  • 0

THere is a oracle query that I am trying to recreate using OpenJPA. I am writing a service in Websphere integration developer, and I am using OpenJPA as my ORM tool of choice. Previously this query was performed using a stored proc, a ref cursor was used and the information was retrieved like that. Now we are trying to use OpenJPA as our tool of choice. So I am thinking that I should then reconstruct the stored proc using OpenJPA…

SELECT DISTINCT
   P.col1 as ID,
   P.col2,
   P.col3,
   P.col4,
   P.col5,
   S.col6,
   PC.col7,
   P.col8,
   A.ADDRESS_1,
   A.ADDRESS_2,
   A.ADDRESS_3,
   A.CITY,
   A.COUNTY,
   A.STATE,
   A.ZIP_CODE,
   P.CONFIRMED_BY,
   P.CONFIRMED_DATE,
   P.MOD_USERID,
   P.MOD_DATE
FROM   EPCD13.PROVIDER P, EPCD13.provider_channel PC, EPCD13.provider_channel_link pcl,
   EPCD13.provider_specialty ps, EPCD13.SPECIALTY S, EPCD13.Address A, EPCD13.ADDRESS_LINK AL
WHERE P.RESOURCE_ID = personID
  AND P.RESOURCE_ID = PS.RESOURCE_ID (+)
  AND 1 = PS.PRIMARY_SPECIALTY_ID (+)
  AND PS.SPECIALTY_ID = S.SPECIALTY_ID (+)
  AND P.RESOURCE_ID = PCL.RESOURCE_ID (+)
  AND PCL.PROVIDER_CHANNEL_ID = PC.PROVIDER_CHANNEL_ID
  AND 1 = PCL.PREFERENCE (+)
  AND 9 = pc.channel_type_id (+)
  AND PC.CHANNEL_ADDRESS NOT LIKE '%@%'
  AND P.RESOURCE_ID = AL.RESOURCE_ID (+)
  AND AL.ADDRESS_ID = A.ADDRESS_ID (+)
  AND 1 = A.ADDRESS_TYPE_ID (+) 
  AND 1 = AL.PREFERENCE (+);

Notice all those inner Joins and so forth. I am thinking right now of putting a named query in one my methods that will return the same results as above. As you may note, there are multiple tables that are being called there and joined at various points… I am thinking I can just put this query into the createNamedQuery() function with minor changes… But I am thinking there has to be a simpler way to do this? Maybe not. Can I just call a stored proc using JPA?

  • 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-04T04:50:14+00:00Added an answer on June 4, 2026 at 4:50 am

    You can create a JPA entity for each table and then join the entities by doing something similar to this:
    http://openjpa.apache.org/builds/1.1.1-SNAPSHOT/docs/jpa_overview_mapping_full.html
    Look at the @OnetoMany and @ManytoOne and @ManytoMany annotations in the example for some ideas.

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

Sidebar

Related Questions

I'm using Oracle 11gR2 and I am trying to write a query that returns
i'm trying to write an Oracle query that sorts the results in the same
Possible Duplicate: Is there an Oracle SQL query that aggregates multiple rows into one
Is there any SQL SELECT query that can be done in oracle to detect
There are many instances where we are not happy with the decisions that Oracle's
I'm having trouble trying to define the SQL query for this table: There's a
I'm trying to write a HQL/Criteria/Native SQL query that will return all Employees that
I'm trying to support multiple databases for an app that I'm writing. The app
I'm using Zend_Db to query a table. I have some WHERE clauses that need
In Oracle we can create an update query that will return the updated record

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.