nhibernate

NHibernate Not Compile on my Window Server

My Apps was developed with NHibernate Working fine on my system but giving this error on the host Server Index was outside the bounds of the array. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in t...

NHibernate Joining Data in HQL

I have the following two tables mapped in NHibernate: VehicleCheck ID (int) VehicleReg (varchar) DriverName (varchar) TS (datetime) VehicleCheckItem ID (int) VehicleCheckID (int) CheckType (int) Passed (bit) What I want to do is get the most recent vehicleCheck for each vehicleReg and a count of vehicle checks failed for each,...

How do I override the automapping for a composite Id, one to many relationship with fluent nhibernate?

I'm polling mulitple systems (domains) for security info so I'm dealing domainUsers and their roles. I've got my entities setup as show below, but I'm having trouble setting up the domainUser.HasMany relationship in the AutoMapper override. You'll notice that I don't have domainUser.DomainUserId and role.RoleId which make this much m...

Should you use the same connection string when using NHibernate and ASP.NET

I have just re-implemented an ASP.NET web application that uses NHibernate to use a session per request (using an IHttpModule). The SessionFactory is created at the start of the application using a connection string from the web.config file. The SessionFactory is then stored and sessions created and released using a thread-safe, lazy s...

Mapping a property of a class to another Table's column in nHibernate?

For some reason in a legacy database I am working with does not have any relationship defined. I have TableA mapped to ClassA. Now in ClassA I need to add PropertyB which has a corresponding column in TableB. How can we add this without adding a Relation? I am using Castle Active Record over nHibernate. ...

nHibernate Many-to-Many query using Criteria API

Hello, Before asking I have looked at all relevant posts on this topic I have also read this blog post: http://ayende.com/Blog/archive/2007/12/23/NHiberante-Querying-Many-To-Many-associations-using-the-Criteria-API.aspx I have Teams and I have Members, there is many-to-many relationship between them Basically: Member -> MemberTeam <-...

Free HQL Editor

Dear All, I want to use hibernate query languange, where can i download the hql editor? Thx ...

NHibernate taking a long time to run query

This is being done using Fluent NHibernate I've got a NHibernate lookup that is retrieving data from one table. If i take the generated sql and run it through query analyzer, it takes ~18ms to run. Using NHProfiler, i'm getting the duration of this query as ~1800ms - 100 times longer than sql ! Query duration - Database only:1800ms...

Selecting objects not in a collection in NHibernate with ICriteria Interface

Hi, In my system Users own 0 or more Categories. Here is a simplified version of my model classes: public class User { public virtual String Name {get; set;} public virtual IList<Category> Categories { get; set; } } public class Category { public virtual String Title {get; set;} } I now want to create an ICriteria query ...

Nhibernate Linq Strange Issue

I am experiencing a strange behavior using Nhibernate linq. I am querying for an entity based on a unique property in the class, although it is not technically the primary key. When I run the query with Nhibernate linq it returns the correct result, but the SQL generated has Select top 2 ... When I run the same query with icriteria there...

How can I disable NHibernate lazy loading for a total application?

In a special case we do not want to change mapping files and adding lazy="false" to each of them because of upgrading NHibernate. Is it possible to disable lazy loading in a total application by just adding something to app.config or web.config? ...

CQRS - The query side

A lot of the blogsphere articles related to CQRS (command query repsonsibility) seperation seem to imply that all screens/viewmodels are flat. e.g. Name, Age, Location Of Birth etc.. and thus the suggestion that implementation wise we stick them into fast read source etc.. single table per view mySQL etc.. and pull them out with somethi...

Fluent NHibernate HasManyToMany IDictionary

I have three tables: Employee, EmployeesCustomer, and Customer. Employee has a primary key called Id. Customer has a primary key called Id. EmployeesCustomer has a composite key made up of two fields, EmployeeId and CustomerId. The EmployeesCustomer does NOT contain any other fields. My goal is to create an IDictionary on the Employee...

Using NHibernate's ISession.Get<>() w/ a composite key

The title says it all. I have a composite key in a database table / NHibernate entity. Can I somehow use the .Get method to grab a specific entity or do I have to use HQL / Criteria due to the composite key? ...

Force query execution without flush/commit

Hi i am using the transaction-per-request (session-in-view) pattern for an asp.net web application. I have a couple of points in the application where i want to Save an NHibernate managed entity and then do a couple of more inserts and updates using common sql. These inserts/updates depend on the ID that the NH saved entity will take. T...

NHibernate - Mapping one property to two or more fields?

I have a database table that includes a two bit fields: IsEvenSide and IsOddSide. I want this to map to the following enum: [Flags] enum SideOfStreet { None, Even, Odd } I have done IUserType's in the past, but I don't know how to map to multiple database fields. How can this be done? P.S.: I'm using Fluent NHibernate, but I'm okay ...

Is this a good solution to handle NHibernate Isession as PerWebRequest

Hi I Have been struggeling with NHibernate session management and have now ended up with two possible solutions to meet a session per web request. I'm using Windsor for IoC in an ASPNET mvc project First solution is to open a session in begin_request and close/dispose it again in end_request. In Windsor setup I would have container.Re...

Removing an item from a collection(NHibernate)

I have parent child relationship between two entities(Parent and Child). My Parent mapping is as follows: <class name="Parent" table="Parents"> ... <bag name="Children" cascade="all"> <key column="ParentID"></key> <one-to-many class="Child"></one-to-many> </bag> </class> I would like to execute the followi...

nhibernate: query criteria for an entity and possibly a subclass in the same query

This is the setup for my 2 entities: public class Person { public Guid Id {get;set;} public string Name {get;set;} } public class Immortal : Person { public string DarkName {get;set;} } Here's what their mapping looks like: <class name="Person"> <id name="Id"> <generator class="guid.comb"/> </id> <property name="Name...

NHibernate exception: method Add should be 'public/protected virtual' or 'protected internal virtual'

Take this class as example: public class Category : PersistentObject<int> { public virtual string Title { get; set; } public virtual string Alias { get; set; } public virtual Category ParentCategory { get; set; } public virtual ISet<Category> ChildCategories { get; set; } public /*virtual*/ void Add(Category child...