-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Oracle10gDialect doesn't support resultsets via stored proce
PostPosted: Thu May 01, 2014 10:09 am 
Newbie

Joined: Wed Apr 30, 2014 4:59 pm
Posts: 1
I tried to utilize Hibernate 4.3.5 (JPA2.1) to invoke Oracle (11.2 v) Stored Procedure within Springframework4.0.1. I am unable to find sample code using dynamic StoredProcedureQuery to call Oracle SP. Based on JPA 2.1 I wrote following code, run it in eclipse utilizing Tomcat 7.0.53 and got below error:

Hibernate: {call GET_CRIS_SMS(?)}
WARN warn - Handler execution resulted in exception
java.lang.UnsupportedOperationException: org.hibernate.dialect.Oracle10gDialect does not support resultsets via stored procedures

Here are my code and config:

-- SP

PROCEDURE GET_CRIS_SMS(P_REF_CURSOR OUT REF CURSOR) IS
BEGIN
OPEN P_REF_CURSOR FOR
SELECT SMS_MSG_ID, APP_NAME, MOBILE_PHONE, COUNTRY_CD, SMS_MSG
FROM CRIS_SMS;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20001, 'No records found ');
END;

-- java

@PersistenceContext
private EntityManager em;

StoredProcedureQuery storedProcedure = em.createStoredProcedureQuery("GET_CRIS_SMS");
storedProcedure.registerStoredProcedureParameter("customers", void.class, ParameterMode.REF_CURSOR);
boolean b = storedProcedure.execute();
if (b == true){
Object obj = storedProcedure.getOutputParameterValue("customers");
}

The exception was thrown from storedProcedure.execute()

-- config

<!-- JPA EntityManagerFactory -->
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
p:dataSource-ref="dataSource">
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
p:databasePlatform="${hibernate.dialect}"
p:database="${jpa.database}" p:showSql="${jpa.showSql}"/>
</property>
<!-- gDickens: BOTH Persistence Unit and Packages to Scan are NOT compatible, persistenceUnit will win -->
<property name="persistenceUnitName" value="petclinic"/>
<property name="packagesToScan" value="org.springframework.samples.petclinic"/>
</bean>

where hibernate.dialect is org.hibernate.dialect.Oracle10gDialect

Thanks a lot for your help!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.