-->
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: Problem calling storeprocedure from hibernate
PostPosted: Fri Jul 23, 2010 10:31 am 
Newbie

Joined: Thu Jul 22, 2010 4:25 pm
Posts: 4
StoreProcedure in Hibernate with annotation

I am using Hibernate JPA implementation.
Storeprocedure has two IN and One OUT parameter as bellow.

PROCEDURE procName(param1 VARCHAR2, param2 CHAR,result_cursor OUT dual_cursorType)

In Java code calling storeprocedure as bellow.

Pojo.java

public static Collection<xxx> findxxxxx(
EntityManagerUtil emUtil,
String param1,
String param2)
{
Query query = emUtil.getEntityManager().createNativeQuery("{call packageName.procName(?,:param1,:param2)}");
//query.setParameter(0, "");
query.setParameter("param1", param1);
query.setParameter("param2",param2);

return (Collection<xxx>)(query.getResultList());
}

I am getting bellow exception :
java.lang.IllegalArgumentException: org.hibernate.QueryException: Expected positional parameter count: 1, actual parameters: [] [{call packageName.procName(?,:param1,:param2)}]

I am not able to find on forum how to register OUT paramter for storedprocedure.


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.