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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:59:36+00:00 2026-06-03T02:59:36+00:00

i used a native query to call a function in my postgresql database, code

  • 0

i used a native query to call a function in my postgresql database, code is like this:

String query = "select details,rec_xml[1] from f_get_reccomendations(\'/ma:recommendations/ma:recommendation/name/text()\') ORDER BY id DESC LIMIT 1;";
Query q = em.createNativeQuery(query); 
return q.getResultList();

the function defined as:

CREATE OR REPLACE FUNCTION f_get_reccomendations (
  IN  xpath    varchar(128),
  OUT id       int,
  OUT recs_num int,
  OUT details  varchar(25),
  OUT d_stamp  timestamp,
  OUT rec_xml  xml[]
) RETURNS SETOF RECORD AS
$$
select id, recs_num, details, d_stamp, xpath($1, recs,
          array [
                  array['xs','http://www.w3.org/2001/XMLSchema'],
                  array['ma','http://schemas.medio.com/analytics/1.0']
                ]
          ) from recommendations;
$$
LANGUAGE SQL;

when ran from the psql, it worked, but when i run in the code, it threw me error:
No Dialect mapping for JDBC type: 2009

my guess is the rec_xml is defined as xml[] type that hibernate could not understand? how can i fix it? 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-06-03T02:59:37+00:00Added an answer on June 3, 2026 at 2:59 am

    First: Are you sure it’s the array of XML, not the xml type its self, that’s the issue? I’ve found Hibernate’s support for Pg’s XML type to be somewhere between poor and nonexistent.

    If it proves to be the array: Try expanding the array of xml into a set, so you return the cross join of `recs’ and the rest of the results. This will require filtering on the client side to de-duplicate results.

    Alternately, you could write a dialect type mapping for xml[] in Hibernate, or cast the xml to text so you return text[].

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

Sidebar

Related Questions

I have a query like below select f.id, s.name, ss.name from first f left
I have a query regarding launching a native application from a link of website
I've used JDBC in several applications now to query Derby, PostgreSQL and now MySQL
If I have two queries SELECT Id, Forename, Surname FROM Person WHERE PersonName Like(‘%frank%’)
I'm developing an Android application with some native code (used to render with OpenGL
I'm using psycopg2 to access a postgresql 8.4 database, and on an update query
I'm looking for a library that can be used in native .NET code, just
We've recently moved from CVS to Subversion 1.6. We used the native Eclipse CVS
I have this mapping ( it comes from adventureworks since I used it in
Can I use a native method which returns a pointer? I used the following

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.