-->
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.  [ 1 post ] 
Author Message
 Post subject: HIbernate in a webservice
PostPosted: Mon Mar 06, 2006 1:04 pm 
Regular
Regular

Joined: Fri Nov 04, 2005 12:37 pm
Posts: 81
Im trying to get hibernate running in a webservice with difficulty, during debugging when i get to the line "cfg.AddAssembly("WebService");" everything come to a halt. And it hard to see what the problem is as no errors i shown in the brower.

Any ideas what is the matter? my assembley name and namespace are both 'WebService'.

Code:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using NHibernate;
using NHibernate.Cfg;


namespace WebService
{
   /// <summary>
   /// Summary description for Service1.
   /// </summary>
   

   [WebService(Namespace="http://microsoft.com/webservices/")]
   public class DlheService : System.Web.Services.WebService
   {
      public DlheService()
      {
         //CODEGEN: This call is required by the ASP.NET Web Services Designer
         InitializeComponent();
         
      }

      #region Component Designer generated code
      
      //Required by the Web Services Designer
      private IContainer components = null;
            
      /// <summary>
      /// Required method for Designer support - do not modify
      /// the contents of this method with the code editor.
      /// </summary>
      private void InitializeComponent()
      {
      }

      /// <summary>
      /// Clean up any resources being used.
      /// </summary>
      protected override void Dispose( bool disposing )
      {
         if(disposing && components != null)
         {
            components.Dispose();
         }
         base.Dispose(disposing);      
      }
      
      #endregion

      [WebMethod]
      public Student[] getDLHERecords(string courseCode,string type, string pass)
      {
         Configuration cfg = new Configuration();
         cfg.AddAssembly("WebService");


         NHibernate.ISession session = null;
      
         ISessionFactory factory = cfg.BuildSessionFactory();
         session = factory.OpenSession();

         IQuery query = session.GetNamedQuery("Students.ByCourse");
               
      
         query.SetParameter(0,courseCode);
         IList a = query.List();

         Student [] drs = new Student[a.Count];

         int i=0;
         foreach(Student r in a)
         {
            drs[i]=r;
            i++;
         }   
            
         return drs;
               
         
      }
   }   
}


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

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.