-->
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: Named query not known: "stored Procedure Name" in
PostPosted: Wed Aug 27, 2008 1:56 am 
Newbie

Joined: Wed Aug 27, 2008 1:27 am
Posts: 1
Location: Chandigarh
How to use Stored Procedure using "nhibernate.Net". Please send exapmle.

I am using this way:-

1. On DefaultPage.aspx


protected void btnInsert_Click(object sender, EventArgs e)
{
Configuration cfg = new Configuration().Configure() ;
cfg.AddAssembly("NewNhibernate");
ISessionFactory factory = cfg.BuildSessionFactory();
ISession session = factory.OpenSession();
ITransaction tx = session.BeginTransaction();
IList products = session.GetNamedQuery("nhibernate").List();
TextBox1.Text = products.ToString();
//TextBox1.Text = q.SetFirstResult(1).ToString();
//TextBox1.Text = p1.Name;
tx.Commit();
}

2. Product.hbm.xml


<?xml version="1.0" encoding="utf-8" ?>
<sql-query name="nhibernate" callable="true">
<return class="Product">
<!--the name refers to the mapped property, and the column is the returned value from the database call-->
<return-property name="Id" column="id" />
<return-property name="Name" column="name" />
<return-property name="Sex" column="sex" />
<return-property name="Weight" column="weight" />

</return>
<!-- write any native SQL needed here, as NHibernate will send this to the database verbatim -->
exec [nhibernate]
</sql-query>


3. I have made all changes in web.config and mapping file.

4. Get this error "Named query not known: nhibernate".

Please Help.

Deepak

_________________
:)


Top
 Profile  
 
 Post subject: Re: Named query not known: "stored Procedure Name" in
PostPosted: Mon Jul 27, 2009 10:26 am 
Newbie

Joined: Mon Jul 27, 2009 10:09 am
Posts: 4
You could try http://www.rmfusion.com. There are some useful code examples on NHibernate.NET under the Open Source section.


Top
 Profile  
 
 Post subject: Re: Named query not known: "stored Procedure Name" in
PostPosted: Tue Jul 28, 2009 10:49 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Have you set Build Action of Product.hbm.xml to Embedded Resource ?

_________________
--Wolfgang


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.