Hibernate Books

All times are UTC - 5 hours [ DST ]

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Calling oracle function from hibernate as named query
PostPosted: Thu Sep 17, 2009 12:06 am 

Joined: Wed Sep 16, 2009 11:56 pm
Posts: 1

I am trying to execute a named query having a call to an oracle function. The following is the mapping
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<sql-query name="getRenewalApplication" callable="true">
<return alias="application" class="TestFn">
<return-property name="COL1" column="COL1" />
<return-property name="COL2" column="COL2" />
{ ? = call api.test_fn(:i_application_id) }

To execute
List list = null;
list = getSession().getNamedQuery("getRenewalApplication")
.setParameter("i_application_id", appId)
This call is throwing an exception
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cls_sessionFactory' defined in class path resource [persistconfig/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Errors in named queries: getRenewalApplication
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)

If I remove the mapping to the java object in .hbm.xml file , the function gets executed and the return is just a list of java.lang.Objects.

Can anyone please help me out with this.


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.