Hi,
I am calling a SQL Stored procedure from .net application using Hibernate object, but somehow its telling me " Named query not known".
I am not sure what's wrong I have done here.
Will really appreciate if someone can help me for this.
Herewith I am providing my Stored Procedure, my .hbm file and code to call it.
can someone pls tell me what's wrong in this?
Also, if possible, pls tell me how to set result in a list object.
Thanks in advance,
#########################################
MY STORED PROCEDURE :
ALTER PROCEDURE [dbo].[RulesDetails_Get]
(
@ELAID INT ,
@FamilyID INT ,
@GroupID INT ,
@SubGroupID INT ,
@ItemComponentID INT ,
@ComponentID INT
)
AS
BEGIN
SELECT
QtyAlreadyOrdered_Component,
QtyAlreadyOrdered_Family,
QtyAlreadyOrdered_Group ,
QtyAlreadyOrdered_SubGroup,
QtyAlreadyOrdered_ELA ,
MaxQtyAllowed_Component ,
MaxQtyAllowed_Family ,
MaxQtyAllowed_Group ,
MaxQtyAllowed_SubGroup ,
MaxQtyAllowed_ELA ,
QtyBalanceAvailable_Component,
QtyBalanceAvailable_Family,
QtyBalanceAvailable_Group,
QtyBalanceAvailable_SubGroup,
QtyBalanceAvailable_ELA
FROM
MyTable1
WHERE
ELAID = @ELAID
AND
FamilyID = @FamilyID
#########################################
#########################################
MY .HBM FILE FOR THIS STORED PROCEDURE:
<?xml version="1.0" encoding="utf-8" ?>
<!-- Generated by MoreGen 28-Apr-2008 11:27:28 -->
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" >
<sql-query name="RulesDetails_Get" callable="true">
<return class="RulesDetails_Get">
<return-property name="QtyAlreadyOrdered_Component" column="QtyAlreadyOrdered_Component"></return-property>
<return-property name="QtyAlreadyOrdered_Family" column="QtyAlreadyOrdered_Family"></return-property>
<return-property name="QtyAlreadyOrdered_Group" column="QtyAlreadyOrdered_Group"></return-property>
<return-property name="QtyAlreadyOrdered_SubGroup" column="QtyAlreadyOrdered_SubGroup"></return-property>
<return-property name="QtyAlreadyOrdered_ELA" column="QtyAlreadyOrdered_ELA"></return-property>
<return-property name="MaxQtyAllowed_Component" column="MaxQtyAllowed_Component"></return-property>
<return-property name="MaxQtyAllowed_Family" column="MaxQtyAllowed_Family"></return-property>
<return-property name="MaxQtyAllowed_Group" column="MaxQtyAllowed_Group"></return-property>
<return-property name="MaxQtyAllowed_SubGroup" column="MaxQtyAllowed_SubGroup"></return-property>
<return-property name="MaxQtyAllowed_ELA" column="MaxQtyAllowed_ELA"></return-property>
<return-property name="QtyBalanceAvailable_Component" column="QtyBalanceAvailable_Component"></return-property>
<return-property name="QtyBalanceAvailable_Family" column="QtyBalanceAvailable_Family"></return-property>
<return-property name="QtyBalanceAvailable_Group" column="QtyBalanceAvailable_Group"></return-property>
<return-property name="QtyBalanceAvailable_SubGroup" column="QtyBalanceAvailable_SubGroup"></return-property>
<return-property name="QtyBalanceAvailable_ELA" column="QtyBalanceAvailable_ELA"></return-property>
</return>
{ call RulesDetails_Get(?,:ELAID, ?,:FamilyID, ?,:GroupID, ?,:SubGroupID, ?,:ItemComponentID, ?,:ComponentID) }
</sql-query>
</hibernate-mapping>
#########################################
#########################################
MY CODE TO CALL STORED PROCEDURE :
NHibernate.ISession hibSession = null;
hibSession = getHibSession();
IQuery q = hibSession.GetNamedQuery("RulesDetails_Get");
q.SetParameter("ELAID", 7);
q.SetParameter("FamilyID", 28);
q.SetParameter("GroupID", 79);
q.SetParameter("SubGroupID", 219);
q.SetParameter("ItemComponentID", 584);
q.SetParameter("ComponentID", 563);
q.List();
#########################################
|