nhibernate

NHibernate / Fluent NHibernate Dynamic Column Mapping

I have a table that, some of its columns are unknown at compile time. Such columns could either be of an integer value, or some Enum value. There is a table that holds all the names of such dynamic columns and also holds the column's type. This "metatable" has the following columns: DynamicColumnId (Pk) Name TypeId (Integer / Enum, as ...

NHibernate- An exception occurred during configuration of persistence layer

Hi, I'm doing a project in Nhibernate with MySql in asp.net. In that while executing the code I got the error like "An exception occurred during configuration of persistence layer" in the below line ISessionFactory factory = new NHibernate.Cfg.Configuration().Configure).BuildSessionFactory(); So let me help to trouble shoot the error...

nhibernate mapping does not save/insert keys of inserted subclasses

After having changed around my mappings a bit ( see my other question about cascade-delete for reasons) , i tried inserting a completely new object and all its subclasses. After this another problem emerged, an issue with the insertion of the keys into the database. Situation is as follows: I have an object with 2 tiers of subclasses, ...

Problem with spring + nhibernate in .net environment

Hi there, I am working with Spring.net 1.3 and nHibernate for .net 1.3. While fetching the application context using XML ( _appContext = new XmlApplicationContext("abc.xml")) I am getting the exception as "Error creating object with name 'NHibernateSessionFactory' defined in abc.xml" Initialization of object failed : The following types...

get property count with entity using nhibernate

Hi, can I am hoping someone can point me to the right direction on how to get count of a property and the entity using a single trip to sql. public class Category { public virtual int Id { get; private set; } public virtual string Description { get; set; } public virtual IList<Article> Articles { get; set; }...

Is it possible to disable a filter which is defined for a property in nhibernate?

I have a filter defined for a property in a mapping file like this; <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false"> <class name="Climate.Domain.CompanyAchievement, Climate.Domain" discriminator-value="0" table="CompanyAchievement"> <id name="Id" column="Id" unsave...

Fluent Nhibernate configuration error in multi thread application

Hi There, I have created an multi thread application on IIS (ASP.NET MVC), When the threading server started it creates 10 thread and it's execting workitems into the threads. Usually my application working well, but some time i have got errors and i'm sure that problem is coming from fluent configuration. And I'm sure again i have ma...

How to construct NHibernate criteria to find parents who has all specified children

A Project can have many Parts. A property on Part is Ipn, which is a string of digits. Project "A" has Parts "1", "2", "3" Project "B" has Parts "2", "3", "4" Project "C" has Parts "2" Project "D" has Parts "3" I want to find all Projects that have all of the specified parts associated with it. My current query is var ...

NHibernate: How to disable virtual for class properties?

Hi, how exactly I can use public methods (non-virtual) with NHibernate? I have this code: public string crewNumber { get { return this.crewNumberField; } set { this.crewNumberField = value; } } Note all my classes, properties, methods and interfaces are ...

Fluent NH and Interface mapping

Im really confused as I have several objects that share a common interface mapped using FNH like so: .Where(t => (t.BaseType == typeof(Entity) || t.BaseType == typeof(PipelineStep)) && t.Namespace.StartsWith("BigNose.Core.Domain") && !t.IsInterface) .IgnoreBase<Entity>() ...

Postgres with Npgsql get periodical error-message every 5 hours

We have an application utilizing NHibernate 2.1.2, Npgsql 2.0.8 and PostgreSQL 8.3.7. We notice that the connection-pool for our application gets trashed at regular time-intervals in our production-enviroment, not occasionally but every 5 hours. When looking at the logfile for postgres, we see this: 2010-03-08 00:02:02 CET LOG: inco...

NHibernate <join> with Multiple Child Records

I have a master record which I'd like to use with. Here's a very basic example mapping example: <class name="Master"> <join table="Detail"> <key> <column name="Id" /> </key> <property name="Name" /> </join> </class> This is all very well, and would work but for one problem. The Detail table looks like: Master_ID Effect...

NHibernate and database connection failover?

I am using NHibernate to connect to a legacy rdbms system. Under high production load the rdbms service fails. To maintain the availability we have a failover rdbms service. Is there a way to configure NHibernate to use the FailOver Connection String when the primary connection is down? Additional Info: I am using Castle over NHibernate...

Good Websites/Blogs/Books to learn nhibernate?

Any Good Websites/Blogs/Books that i can have a look at for learning nhibernate... I have looked at NHibernate for .NET from Hibernate Core site.... Any other good ones.... ...

nHibernate collections and alias criteria

I have a simple test object model in which there are schools schools have a collection of students. I would like to retrive a school and all its students who are above a certain age. I carry out the following query in the following manner : public School GetSchoolAndStudentsWithDOBAbove(int schoolid, DateTime dob) { va...

NHibernate Lambda exressions - are they turned into SQL.

Hi, I'm a bit of a NHibernate newbie and Im taking on some code written by another developer. I want to find out how NHibernate converts lambda based criteria into SQL. I know in Linq to SQL using Lambda expressions on queries means that the whole thing is turned into an expression tree and then into SQL (where possible) by the Linq to ...

NHibernate: Violated not-null constraint when saving HasMany relation with Cascade=AllDeleteOrphan

Hi, My bean looks like this: public class A { ... [HasMany (MapType = typeof(B), Table = "B_table", ColumnKey = "A_object_id", Fetch = FetchEnum.Join, RelationType = RelationType.List, Index = "id", Cascade = ManyRelationCascadeEnum.AllDeleteOrphan)] IList<B> BList { get; ...

NHIbernate Newbie: Can someone please explain why NHibernate attempts to execute a database update during CreateQuery execution

Basically, I wish to fetch a filtered set of objects from the database (Oracle 9.2) based on the id property of the object PsalertsEvent. The code being executed is: Public Overloads Function GetAll(ByVal laterThan As Long, ByVal filteredPsalertsEvents As IList) As IList Implements IPsalertsEventRepo.GetAll 'Get all psalert...

FluentNhibernate Mapping Using References Index Out of Range When Adding new Object

I am trying to map a parent child relationship between a Person object and a Organization object in FluentNHibernate using References in the mapping file like this: References(x => x.Organization); The relationship is a Person object contains a OrganizationId column that corresponds to a record in the Organization table with the corres...

What datatype should be used for the Id primary key columns using a hilo generator and sql server?

If I am using a hilo generator with nhibernate, what should the datatype for my id column be? int or bigint? ...