-->
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: Exception trying to execute a stored proc
PostPosted: Wed Mar 10, 2010 10:52 am 
Newbie

Joined: Mon Oct 31, 2005 2:35 pm
Posts: 4
..on Oracle: java.lang.IllegalArgumentException: callable not yet supported for native queries

.hbm.xml:
Code:
<sql-query name="inventoryReport" callable="true">
    { call INVENTORY_REPORT() }
</sql-query>


Java:
Code:
session.getNamedQuery("inventoryReport").executeUpdate();


I searched on this and the most useful information is from like 2007. From this, there seems to be two solutions and i have concerns with each one.

First Solution: Replace the getNamedQuery() line with:
Code:
CallableStatement stmt = session.connection().prepareCall("{ call INVENTORY_REPORT() }");
stmt.execute();

My Issue: the connection() method is deprecated. And putting the actual SQL in the code kinda defeats the purpose of using Hibernate. This solution is not that far removed from being straight up JDBC code.


Second Solution: Get the latest version.
My Issue: I downloaded version 3.3.2.GA around a week or so ago, so i would imagine that i have at least a later version than this suggestions from '07.

For now, i'm using the first solution despite the deprecation. I'm just wondering if there is an update on how to call a stored proc. I really don't like hard coding calls in my Java code and using a deprecated method bothers me as well.

Thanks,
Miz


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.