-->
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: Calling Oracle Stored Procedure
PostPosted: Thu Jun 30, 2005 6:48 pm 
Newbie

Joined: Thu Jun 30, 2005 6:22 pm
Posts: 1
Hibernate version:
3.0

Mapping documents:
<hibernate-mapping>
<class
name="ContactType"
>

<id
name="type"
column="contact_type"
type="java.lang.String"
unsaved-value="null"
>
<generator class="assigned">

</generator>
</id>
<property
name="desc"
type="java.lang.String"
update="true"
insert="true"
column="description"
length="20"
/>
<sql-insert callable="true">{call create_contact_type(?,?)}</sql-insert>
</class>
</hibernate-mapping>


Name and version of the database you are using:
Oracle 9i
Stored procedure is:
CREATE OR REPLACE PROCEDURE create_contact_type
(p_type IN varchar2,
p_desc IN varchar2) IS
BEGIN
INSERT INTO CONTACT_TYPE (CONTACT_TYPE, DESCRIPTION)
VALUES (p_type,p_desc);
commit;
END;
/
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Right now, I have an application that uses numerous stored procedures. I am trying to access these stored procedures through hibernate. After calling session.save(contactType), the data gets saved to the database but the data is switched around. Type column contains Description data and Description column contains Type data. It seems like when hibernate binds to the ? parameters, it puts Type value last since it is an ID. Is there any way to tell hibernate to do Type first and then Description. It seems like reordering the parameters in the mapping file does not work since "Type" is an id. Changing the order of parameters in the stored procedure is not a valid option since this is an existing application. Is there a patch for support of named parameters : in custom sql? Is there a workaround for this?

_________________
DBH


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.