-->
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: Don't understand 18.2.2.Using stored procedures for querying
PostPosted: Fri Sep 30, 2011 9:19 pm 
Newbie

Joined: Fri Sep 30, 2011 8:38 pm
Posts: 1
I have managed to avoid using stored procedures, until now. I find plenty of questions about this but no useful answer.
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/querysql.html#sp_query raises more questions than it answers.

I have to call several Oracle stored procedures that have one OUT parameter and one or more IN parameters. i.e.
PROCEDURE IsAnythingAssignedToUser(
OUT_READ_PI_VARS OUT SYS_REFCURSOR,
IN_READER IN READ_PROCESS_INSTANCE.ASSIGNED_READER%TYPE,
IN_WORKFLOW_STATE_ARRAY IN String_Array
);
There's only one entity mapped to only one table. I try to call it in all the ways I can think of i.e.
Query query = entityManager.createNativeQuery("{? = call READ_WORKFLOW_PKG.IsAnythingAssignedToUser(?,?)}",ReadProcessInstance.class)
.setParameter(2, readerId).setParameter(3, workflowStateIds);
But I don't know what to do for the OUT parameter, is "{? = call" supposed to be parameter 1. I don't know if I MUST map sql-query or if I should use the annotations @SqlResultSetMapping, @NamedNativeQuery

If the Entity class is already has Table and Column annotations why do I need yet another mapping?


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.