-->
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: Problem with stored procedure..
PostPosted: Thu Nov 17, 2005 6:44 pm 
Regular
Regular

Joined: Tue Nov 08, 2005 1:30 pm
Posts: 50
Hi gurus,
I am calling function from my java code using hibernate.. When i remove [u]Where[/u] condition then its working properly..when i use where condtion its giving error.

Error:

java.lang.ArrayStoreException
at java.lang.System.arraycopy(Native Method)
at java.util.ArrayList.toArray(ArrayList.java:305)
at org.hibernate.util.ArrayHelper.toTypeArray(ArrayHelper.java:75)
at org.hibernate.impl.AbstractQueryImpl.typeArray(AbstractQueryImpl.java:674)
at org.hibernate.impl.AbstractQueryImpl.getQueryParameters(AbstractQueryImpl.java:682)
at org.hibernate.impl.SQLQueryImpl.getQueryParameters(SQLQueryImpl.java:173)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:165)
at examples.schema.GetPatientData.main(GetPatientData.java:26)


Here is the function:

CREATE OR REPLACE FUNCTION selectAllEmployments
RETURN SYS_REFCURSOR
AS
st_cursor SYS_REFCURSOR;
number1 number;
BEGIN
OPEN st_cursor FOR
SELECT p.KEY_CD,p.KEY_ORIGINAL_TXT
FROM PATIENT_DATA p where p.key_cd=kasi;
RETURN st_cursor;
END;
/


Mapping file is :
sql-query name="Query_PatientData_SP" callable="true">
<return-scalar column="KEY_CD" type="long"/>
{?=call selectAllEmployments(?)}
</sql-query>[b][quote][/quote][/b]



Please help me..
Ur help is apppreciated with full points..
Thanks
Nag


Top
 Profile  
 
 Post subject: Problem with stored procedure..
PostPosted: Thu Nov 17, 2005 6:45 pm 
Regular
Regular

Joined: Tue Nov 08, 2005 1:30 pm
Posts: 50
Hi gurus,
I am calling function from my java code using hibernate.. When i remove [u]Where[/u] condition then its working properly..when i use where condtion its giving error.

Error:

java.lang.ArrayStoreException
at java.lang.System.arraycopy(Native Method)
at java.util.ArrayList.toArray(ArrayList.java:305)
at org.hibernate.util.ArrayHelper.toTypeArray(ArrayHelper.java:75)
at org.hibernate.impl.AbstractQueryImpl.typeArray(AbstractQueryImpl.java:674)
at org.hibernate.impl.AbstractQueryImpl.getQueryParameters(AbstractQueryImpl.java:682)
at org.hibernate.impl.SQLQueryImpl.getQueryParameters(SQLQueryImpl.java:173)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:165)
at examples.schema.GetPatientData.main(GetPatientData.java:26)


Here is the function:

CREATE OR REPLACE FUNCTION selectAllEmployments
RETURN SYS_REFCURSOR
AS
st_cursor SYS_REFCURSOR;
number1 number;
BEGIN
OPEN st_cursor FOR
SELECT p.KEY_CD,p.KEY_ORIGINAL_TXT
FROM PATIENT_DATA p where p.key_cd=number1;
RETURN st_cursor;
END;
/


Mapping file is :
sql-query name="Query_PatientData_SP" callable="true">
<return-scalar column="KEY_CD" type="long"/>
{?=call selectAllEmployments(?)}
</sql-query>[b][quote][/quote][/b]



Please help me..
Ur help is apppreciated with full points..
Thanks
Nag


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 17, 2005 8:46 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the where condition in your stored procedure cannot in any way affect that exception. Looks more like you have a multicolumn property you don't map properly in the native query.

_________________
Max
Don't forget to rate


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.