nhibernate

User Session in ASP.Net MVC App

Hi friends! In my web application (asp.net mvc) I have an restrict area. In my model, I have an entity called "User" represents a user can do login/logout in web app. I've used Forms Authentication to login/out my users and everything works fine but, I'd like to know, if is there any way to save an entity (of the user logged) during the...

How to convert IEnumerable<table> to XML from Nhibernate?

Hi, All the tutorials that I see online when converting a database table to XML always involves a Data Context. However, I'm using Fluent Nhibernate mappings and therefore I don't want to do this. Is there a way to say convert an IEnumerable to XML document instead? Or are there any other ways to get data from an Nhibernate mapped data...

Need help understanding this NHibernate error message

Hi, I'm using VS 2008, ASP.NET MVC with NHibernate 2.0. I get the following error of row not found when I retrieve collection of objects from 2 manyTomany tables. Here what is the "Identifier" 296 refers to? Is that the same as Application object with "Id" = 296? I search the manyTomany index table, ApplicationResearchInterests, and foun...

NHibernate: NHibernateConfigException

Hi, I'm starting with VB.NET and NHibernate but i'm getting this exception: NHibernateConfigException was unhandled An exception occurred during configuration of persistence layer. This is the code Dim configuration As New Cfg.Configuration() configuration.Configure() configuration.AddFile("person.hbm.xml") Dim f...

WCF/S#arpArch: underlying ISession is closed after the first call within a request

I've the same problem like that question: http://stackoverflow.com/questions/1807485/wcf-call-fails-because-underlying-connection-was-closed But I could not get it to work with the answer 2. As Sandor says, "before the WCF service response is sent, it always closes all NHibernate sessions.", well that's good but for me it must clean the...

nhibernate or in sql statement

how do i get the equivalent of sql "or" in nhibernate I have the following method. Basically i wish to see if the keyword is found in product.Name or Product.Description. public ICollection<ProductCategory> FindByCompanyIdAndSearchAndPop(int companyId, string keyword) { var products = _session .CreateCriteri...

Referencing 2 differents versions of log4net in the same solution

I'm using NHibernate 2.1.2.400 that is referencing log4net 1.2.10.0. In the same project, I also use the simply accounting SDK, sadly it is still using log4net 1.2.9.0. So I can get NHibernate to work if I reference log4net 1.2.10.0 but the simplySDK don't work. And vice versa... I'm guessing most of the problems come from the fact th...

Nhibernate - Mapping many to many dictionary

I have the following classes: public class A { public virtual int Id { get; private set; } public virtual IDictionary<MyEnum, B> MyBValues { get; set; } } public class B { public virtual int Id { get; private set; } } public enum MyEnum { Value1, Value2, Value3 } And would like the following tables: A ------------...

NHibernate new SchemaExport(cfg).Execute(false, true, false, false); No fourth bool parameter!

I'm trying to follow the NHibernate tutorial, "Your first NHibernate based applicaton:Revision #4" at NHibernate Forge. But the line: new SchemaExport(cfg).Execute(false, true, false, false); Will not compile because it says there is no overload that takes four boolean paramaeters! I am using NHibernate 2.1.2 in Visual Studio 2008 C...

nHibernate Join syntax error

I am doing my first nHibernate Join. In my function below, I want to return a list of records for the specified query. Normally my List type is the class representing the database table. In this case, since I am doing a join, I created a custom class that only contains the fields for the columns I am retrieving from the database. How...

How to set database schema for namespace in nhibernate

Hi, I have a database with multiple schemas: Security, Trade, etc. Each shema has multiple tables. Ie. Security schema has: Users, Roles etc.. Now, can I setup nhibernate so that the schema i bound to namespace. Ie. I have a security namespace in my project with the User and Role POCOs in it. So I wont to set bind database schema to nam...

NHibernate sessions/transactions acting differently on IIS6 and Visual Studio 2008 Debug Server

I am using an HttpModule for handling my NHibernate Sessions and Transactions. I have many pages that are being very cranky about transactions not successfully starting on my IIS6 box but not when I run them locally, specifically when I try to call Commit() on the transactions during a PostBack to refresh datagrids with new updated data....

Fluent NHibernate: IEnumerable component mapping from a single query?

Hi, Hoping you can help me with a mapping problem I have. At the moment I have a view which returns something such as: Name | Title | Price | Date | Format | FormatPriority | Example data may be: Bob | Credits | 340 | 01/01/2010 | BAR | 10 | Bob | Credits | 340 | 01/01/2010 | FOO | 20 | Bob | Credits | 340 | 01/01/2010 | WOO | 40 | ...

ORM tool OR build the object to relational mapping layer manually

I am trying to determine what if any advantage or disadvantage there is to using an object to relational mapping layer like hibernate or the Microsoft Entity framework when building the data layer. Is using sql and mapping objects by hand better in the long run or is it better to leverage one of these mapping technologies? It seems ...

SQL Server 2005 Network IO Wait Times (ASYNC_NETWORK_IO Wait Type) Problem

Hi, We are having performance issues on our web app during peak times, which is currently split between one 2003 IIS6 Web Server, and one SQL Server 2005 DB Server. The query times on the DB server look fine (around 30ms), and the CPU is low (under 20%), yet queries can take a long time to execute on the web server (over 1 second). I w...

nhibernate auditing with events on update

The following code works on insert but on update modifier is never set, any ideas why? The code for pre-update is being run and correctly sets the state and entity values to the desired value. However when viewing the generated sql nhibernate does not include the field in the update query. /// <summary> Updates auditable objects </summ...

Unit Test passes in Visual Studio but fails on the command line (cant find Castle.Core)

Hi, I have a weird issue. My unit test passes in the IDE but fails in the command line (usually I'd expect it the other way around). I'm using Visual Studio Team System 2008, and .net 3.5. I have a 'soft' dependency in my project on NHibernate (NHibernate.ByteCode.Castle.dll) and on Castle (Castle.DynamicProxy2.dll). I've setup the t...

Extending a nhibernate mapping

Hi, I made a commen on this question: http://stackoverflow.com/questions/2761255/extending-fluent-nhibernate-mappings-in-another-assembly The person who asked that question got misunderstood and I want to know if its possible to do what he asks. Simply put: Running application with an entity public class Product { public virtua...

nhibernate <subclass><join> nest another sublass mapping (cause duplicate insertion of leaf class)

What's wrong with this mapping? On saving an instance of Class3, two rows in Table_2 will be inserted! first row has Column4 set to null and correct value of Column3, and second row has Column3 set to null and correct value of Column4! <class name="Class1" table="Table_1"> <id name="Column1"> <generator class="native" /> ...

StructureMap returns a disposed nHibenrate session object from thread local scope

I have this web application which uses SM for IoC. I am using HybridHttpOrThreadLocalScoped scope to store my nHibernate ISession objects. This works ok in a session per request fashion for my web requests. But I also have quartz.net that schedules couple of jobs. The job uses the same unit of work to get the ISession object. In this s...