facebook

Stored Procedures and JPA

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #277450 Reply

    marc_nikko
    Member

    Hi,

    I’m using MyEclipse and JPA/Hibernate. I like the JPA pagination feature. However, I need to call stored procedures in my application. Specifically, I created a stored procedure:

    
    CREATE OR REPLACE PROCEDURE MCRUZ.HIBERNATETESTINSERT (
      valStr IN VARCHAR2,
      valNum IN NUMBER,
      valDate IN DATE,
      valClob IN CLOB,
      result OUT VARCHAR2
    ) AS
    --
    -- NAME        : 
    -- DESCRIPTION : 
    -- AUTHOR      : 
    
    BEGIN 
      insert into HIBERNATE_TEST values(valStr, valNum, valDate, valClob);
      result := 'SUCCESS';
    END;

    which I try to call using createNativeQuery

    ...
    final String queryString = " call hibernatetestinsert(?1, 5, null, null, ?2)";
    Query query = getEntityManager().createNativeQuery(queryString);
    String test = new String();
    query.setParameter(1, "HelloParameter");
    query.setParameter(2, test);
    return query.getSingleResult();
    ...

    I keep getting exceptions like

    org.hibernate.HibernateException: Could not extract result set metadata

    Does JPA/Hibernate work with stored procedures? If so, what can I use to execute the stored procedure? If not, should I go back to jdbc or use some other technology?

    Thank you,

    Marc Cruz

    Marc

    #277717 Reply

    Riyad Kalla
    Member

    This message has not been recovered.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Stored Procedures and JPA

You must be logged in to post in the forum log in