Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found the issue. I was using a javax.persistence version of the Session and Query classes and not the org.hibernate version; javax.persistence does not support Oracle Stored Procedure calls while Hibernate does. The difference is subtle without the import statements provided below. The give away should have been the use of the sqlQuery.getResultList(). This is a JPA method call that does not exist in the Hibernate version of Query.</p> <p>import import javax.persistence.Query;</p> <p>Query sqlQuery = entityManager.createNamedQuery("oracleproccall"); List list = sqlQuery.getResultList(); </p> <p>The construct for using the Hibernate version is query.list() not query.getResultList():</p> <pre><code>import java.util.Iterator; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import com.myco.entities.ApplicationR private void anotherTest() { Configuration cfg = new Configuration(); cfg.configure("hibernate.cfg.xml"); SessionFactory sf = cfg.buildSessionFactory(); Session s = sf.openSession(); Transaction tx = s.beginTransaction(); List&lt;AppR&gt; apps; Query namedQuery = s.getNamedQuery("oraclestoredproc"); apps = namedQuery.list(); apps = s.getNamedQuery("oraclestoredproc").list(); Iterator&lt;ApplicationR&gt; iterator = apps.iterator(); while (iterator.hasNext()) { ApplicationR app = (ApplicationR) iterator.next(); System.out.print(app.getApplicationId() + " "); System.out.print(app.getAppCommonNm() + " "); System.out.print(app.getAppDesc() + " "); System.out.println(app.getAppUrl() + " "); } s.flush(); tx.commit(); s.close(); } </code></pre> <p>Thanks to Jitu Ji and to this <a href="http://www.coderanch.com/t/466425/ORM/databases/Working-Hibernate-Call-Oracle-Stored" rel="nofollow noreferrer">source</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload