-->
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.  [ 3 posts ] 
Author Message
 Post subject: So strange Stored procedure parameter order!
PostPosted: Fri Jul 15, 2005 10:05 am 
Regular
Regular

Joined: Tue Dec 30, 2003 2:35 am
Posts: 85
hi:
i write a procedure of oracle:
/**********************************************/
create or replace procedure sp_affair_insert
(
p_affairid in varchar2,
p_affairstate in varchar2,
p_affairtypeid in varchar2
)
as
begin
insert into affair(affairid,affairstate,affairtypeid)
values(p_affairid,p_affairstate,p_affairtypeid);
end;
and in the hbm.xml i write:
/*************************************************/
<hibernate-mapping package="org.Debug.Hibernate.yhb">

<class name="Affair" table="AFFAIR">
<id name="affairid" column="AFFAIRID" type="string">
<generator class="assigned"/>
</id>

<property name="affairstate" column="AFFAIRSTATE" type="string" not-null="true" />
<property name="affairtypeid" column="AFFAIRTYPEID" type="string" not-null="true" />

<sql-insert callable="true">{call sp_affair_insert(?,?,?)}</sql-insert>
</class>

</hibernate-mapping>[/code]
i find the order of parameter become out-of-order,not the order i hope

i can't find the rule of the procedure parameter order from the document of the hibernate3!
can some one tell the rule of parameter order (only id to the last parameter,i mark the parameter order in specifical color)!

thanks for any help!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 10:23 am 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
You currently have to match whatever order Hibernate would use for its insert statement. Here is an excerpt from the docs (http://www.hibernate.org/hib_docs/v3/reference/en/html/querysql.html#querysql-cud):

Quote:
The order of the positional parameters are currently vital, as they must be in the same sequence as Hibernate expects them.

You can see the expected order by enabling debug logging for the org.hiberante.persister.entity level. With this level enabled Hibernate will print out the static SQL that is used to create, update, delete etc. entities. To see the expected sequence, remember to not include your custom SQL in the mapping files as that will override the Hibernate generated static sql.



Top
 Profile  
 
 Post subject: A regular parameter for hibernate's procedure is so easy ...
PostPosted: Tue Jul 19, 2005 3:32 am 
Regular
Regular

Joined: Tue Dec 30, 2003 2:35 am
Posts: 85
A regular parameter for hibernate's procedure is so easy for author,why did you like the out-of-order parameter ?

before i want to write a automatic code for oracle procedure by my java code ,but the order of parameter is not regular ,so i can't realize some thing?

thanks for any help!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

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.