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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:36:16+00:00 2026-06-12T05:36:16+00:00

I have a problem where I am getting an: org.hibernate.MappingException: No Dialect mapping for

  • 0

I have a problem where I am getting an: org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111 when trying to call a postgres function using JPA create native query.

I created an EJB timer in a startup singleton to run a Postgres function every 6 hours. The function returns void and checks for expired records, deletes them, and updates some statuses. It takes no arguments and it returns void.

  • The postgres function runs perfectly if I call it using PgAdmin query tool (select function();) and returns void.

  • When I deploy the app on Glassfish 3.1.1 I get an exception and a failure to deploy.

This is the (shortened) stack trace:

WARNING: A system exception occurred during an invocation on EJB UserQueryBean method public void com.mysoftwareco.entity.utility.UserQueryBean.runRequestCleanup()
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean
...STACK TRACE BLAH BLAH BLAH ...
Caused by: javax.persistence.PersistenceException: org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111

Here is the code:

First the JPA stuff:

public void runRequestCleanup() {
    String queryString = "SELECT a_function_that_hibernate_chokes_on()";
    Query query = em.createNativeQuery(queryString);
    Object result = query.getSingleResult();
}

This is the singleton calling it:

@Startup
@Singleton
public class RequestCleanupTimer {
    @Resource
    TimerService timerService;
    @EJB
    UserQueryBean queryBean;

    @PostConstruct
    @Schedule(hour = "*/6")
    void runCleanupTimer() {
        queryBean.runRequestCleanup();
    }
}

And the function:

CREATE OR REPLACE FUNCTION a_function_that_hibernate_chokes_on()
  RETURNS void AS
$BODY$
    DECLARE 
        var_field_id myTable.field_id%TYPE;
    BEGIN
        FOR var_field_id IN
                select field_id from myTable 
                where status = 'some status'
                and disposition = 'some disposition'
                and valid_through < now()
        LOOP
            BEGIN
                -- Do Stuff
            END;
        END LOOP;
    END;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
  • 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-12T05:36:17+00:00Added an answer on June 12, 2026 at 5:36 am

    I had enough messing around with JPA trying to get it to run a stored procedure.

    I ended up using JDBC with a prepared statement. I did it in 15 minutes after spending several fruitless hours trying to fit a square peg into a round hole. I called the same jndi datasource my persistence unit uses to get a connection, created a prepared statement and closed it when done.

    So if you need to run a stored procedure (or Postgres function) from a (now mostly) JPA app, here is what worked for me:

    @Stateless
    @LocalBean
    public class UserQueryBean implements Serializable {
    
        @Resource(mappedName="jdbc/DatabasePool") 
        private javax.sql.DataSource ds;
    
        ...
    
        public void runRequestCleanup() {
    
            String queryString = "SELECT cleanup_function_that_hibernateJPA_choked_on()";
            Connection conn = null;
            PreparedStatement statement = null;
            try {
                conn = ds.getConnection();
                statement = conn.prepareCall(queryString);
                statement.executeQuery();
            } catch (SQLException ex) {
                Logger.getLogger(UserQueryBean.class.getName()).log(Level.SEVERE, null, ex);
            }finally{
                try {
                    statement.close();
                    conn.close();
                } catch (SQLException ex) {
                    Logger.getLogger(UserQueryBean.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            // bit of logging code here    
        }
        ...
    }
    

    There seems to be a horrible oversight to leave out the simple ability to run a function or stored procedure on the server from JPA; especially one that doesn’t return anything except void or the number of rows affected. And if it was deliberate … no comment.

    Edit: added close connection.

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

Sidebar

Related Questions

I have a problem with getting my pager-function to work. For some reason it
I just started a graphical C++ course and I have problem getting an overview
I have a problem getting password_Reset_confirm bit working. url: (r'^password_reset/$', 'django.contrib.auth.views.password_reset'), (r'^password_reset_done/$', 'django.contrib.auth.views.password_reset_done'), (r'^password_reset_confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
I have a problem getting the right Price for a product based on Effectivity
I have a problem getting boost::multi_index_container work with random-access and with orderd_unique at the
I have a problem getting a private method using reflection. Even with BindingFlags.NonPublic and
I have this problem getting my newly created php project on Netbeans work on
I'm using jqGrid and I have a problem getting Dynamic Linq to work. I
I have a strange problem getting the color of the point that was touched.
I have a problem with getting jquery to retrieve results from a WCF service.

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.