-->
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: Invoking function/stored procedures with arrays as params
PostPosted: Thu Jul 07, 2011 9:59 am 
Newbie

Joined: Wed Jul 06, 2011 11:21 am
Posts: 1
Hi all, I'm using postgreSQL and have the following function:

Create or replace FUNCTION update_my_entity(my_entity_array my_entity[] ) RETURNS INTEGER
AS $procedure$
declare v_row my_entity;
declare v_cnt int4;
BEGIN
FOR v_cnt IN array_lower(my_entity_array, 1) .. array_upper(my_entity_array, 1) LOOP

v_row := my_entity_array[v_cnt];
update my_entity set my_entity.status = v_row.status
where
my_entity.vm_guid = v_row.vm_guid;
END LOOP;

my_entity is a pgsql type that I defined. It has an equivalent Java class named MyEntity and I would like to update an array of MyEntity objects using hibernate.

I would like to know if invocation of stored procedures/functions that receive arrays of types (not just array of primitives or their matching classes or of strings) is possible in Hibernate.
In addition, will I have to map MyEntity to my_entity using a dialect that extends HIbernate's postgreSQL hibernate (or define a custom type somehow).

Thanks for the help!


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.