HI I am using NHibernate30.As per our requirement we need to send User
Defined data type(i.e Custom Data Type ) as a parameter to stored
procedure.With ADO.net this is working
following are my Stored Procedure,Type and domain Object .
*************Store Procedure****************
create or replace
PROCEDURE odp_varray_sample_proc(p_cursor out SYS_REFCURSOR,param IN
odp_varray_sample_type)
IS
BEGIN
FOR
counter IN 1..3
LOOP
insert into temp_tran (emp_id, emp_name, emp_password,
team_associated_with,IS_CAPTAIN,NO_OF_MOM,BALANCE)
SELECT EMP_ID,EMP_NAME,EMP_PASSWORD,TEAM_ASSOCIATED_WITH,
IS_CAPTAIN,NO_OF_MOM,BALANCE FROM employee WHERE
EMP_ID=param(counter);
end LOOP;
open p_cursor for select * from temp_tran;
delete from temp_tran;
END odp_varray_sample_proc;
*****End Stored Procedure**********************
**TYpe in Database Oracle***********
create or replace type odp_varray_sample_type as varray(3000) of
number;
****End Type in Database Oracle******
*****Domain Object*****************************
public class odp_varray_sample_type : NHibernate.Type.ImmutableType
{
public Int64[] int_array;
public odp_varray_sample_type()
: base(new
NHibernate.SqlTypes.SqlType(System.Data.DbType.Object))
{
}
public odp_varray_sample_type(Int64[] array)
: base(new
NHibernate.SqlTypes.SqlType(System.Data.DbType.Object))
{
this.int_array = array;
}
public override object FromStringValue(string xml)
{
return xml.ToString();
}
public override object Get(System.Data.IDataReader rs, string
name)
{
return name.ToString();
}
public override object Get(System.Data.IDataReader rs, int
index)
{
return index.ToString();
}
public override void Set(System.Data.IDbCommand cmd, object
value, int index)
{
OracleCommand orclCmd = (OracleCommand)cmd;
orclCmd.Parameters[index].OracleDbType
= OracleDbType.Int64;
orclCmd.Parameters[index].CollectionType
= OracleCollectionType.PLSQLAssociativeArray;
orclCmd.Parameters[index].Value = value;
}
public override string ToString(object val)
{
return val.ToString();
}
public override string Name
{
get
{
return Name;
}
}
public override Type ReturnedClass
{
get
{
return this.GetType();
}
}
}
*****END Domain Object*****************************
Error coming as
Wrong number of argument or type.Please help.
Does NHibernate suppots passing Custon data type as a parameter to
Stored procedure
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.