-->
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: Is it possible to retrieve a collection from a SP?
PostPosted: Thu Oct 01, 2009 10:25 am 
Newbie

Joined: Mon Aug 31, 2009 7:24 am
Posts: 7
Hi there,

I've got a SP in Oracle that returns a collection of object:
Code:
create or replace TYPE SAMPLED_VALUE AS OBJECT
( data_timestamp date,
  data_value number(8,2)
);

create or replace TYPE SAMPLED_VALUES_ARRAY AS TABLE OF SAMPLED_VALUE;

valuesMap := sampled_values_array();


I would use a named query to call the SP but I don't know how to map the returned value and the input parameters. The signature of my SP is the following:

Code:
create or replace
PROCEDURE MY_SP(
id IN NUMBER, dateFrom IN DATE, dateTo IN DATE, step VARCHAR2, valuesMap OUT NOCOPY SAMPLED_VALUES_ARRAY, error_code OUT NOCOPY NUMBER, error_description OUT NOCOPY VARCHAR2
) AS
...


Can you help me, if is it possible to have an Oracle collection mapped in Hibernate?
Indeed, I've just read this in the reference doc:

Quote:
Stored procedures currently only return scalars and entities. <return-join> and <loadcollection>
are not supported.


Also, it seems that there are some strict rules in using SP with Hibernate:

Quote:
The first parameter of a procedure must be an OUT that
returns a result set. This is done by using a SYS_REFCURSOR type in Oracle 9 or 10. In Oracle
you need to define a REF CURSOR type. See Oracle literature for further information.


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.