nhibernate

Problem on mapping sql results to entities in nhibernate

I have an associated set of entities. And in mapping files I made them to be fetched by join. When a query is executed, the executed query and results seem allright. But when I tried to traverse the properties. Some of associated properties are being duplicated. When I create my criteria I set the trasformer as "distinct root entity". ...

Can't get nhibernate config section out though configuration manager.

I'm trying to to setup Memcached 2nd level caching. I've followed what documentation I could find, including downloading the project from SVN and looking at how it is configured in their test project, and ended up with this in my app.config. <configuration> <configSections> <section name="memcache" type="NHibernate.Caches.MemCache...

Fluent NHibernate Automap Joined Sub-Class Setting the Key

When automapping a joined subclass in fluent nhibernate, I can't figure out how to give the joined subclass a primary key. public class Address:Entity { public virtual string Address1 { get; set; } public virtual string Address2 { get; set; } public virtual string City { get; set; } public virtual string State { get; set; } public ...

Which data framework is better for an ASP.NET MVC site - LINQ to SQL or NHibernate

We're about to embark on some ASP.NET MVC development and have been using our own entity framework for years. However we need to support more than our entity framework is capable of and so I'd like to get some opinions about using MVC with a more robust framework. We have narrowed down or choices to either NHibernate (with the Fluent API...

Seting up NHibernate Validator with Spring.net

How can I setup NHibernate Validator with Spring.net as IoC? I am already using Spring.net integration with NHibernate and can't get AutoRegisterListeners to work. What I need is to setup NHV to validate entities automatically upon Update/Save instead of having to call Validate method every time and use Spring.net with ISharedEnginePr...

How to get the return value from a SQL Server Stored procedure into nHibernate?

1.Database platform: SqlServer 2.Data Access: nHibernate 1.2 Now we need access the store procedure by nHibernate,like this: ALTER PROCEDURE TestProc() AS BEGIN Select * From User Return 1234 END I know I can get the User List by IQuery, And I want to get the default return value "1234" too. Question: How to...

Parsing criteria in NHibernate

Is it possible to parse criteria from string? ...

Mapping Table Enums in NHibernate

I'm currently building a new app based on a legacy database. In the app, there are many "list" tables that have the following format: table listLanguages { PrimaryId bigint; Item varchar(30); } ...with some sample entries like this: PrimaryId Item 1 English 2 French 3 Spanish ... They were used to p...

nhibernate - delete throws "deleted object would be re-saved by cascade"

hi i have following model: <class name="Person" table="Person" optimistic-lock="version" > <id name="Id" type="Int32" unsaved-value="0" > <generator class="native" /> </id> <!-- plus some properties here --> </class> <class name="Event" table="Event" optimistic-lock="version" > <id name="Id" type="Int32" u...

NHibernate SchemaUpdate

From personal experience, as well as everything I've read, NHibernate's SchemaUpdate doesn't support removing columns and tables. I'd like to use SchemaUpdate to generate migration DDL, but not having the deletes is making it more difficult. How do you get around this? Are there other tools that would help to keep the focus on the dom...

NHibernate inheritance and split table

i have a table stracture which lends itself to table per subclass design. my "base" table has many common fields and each one of the children also has many fields that are unique for that entity. this works very well with joined-sublass where the common fields are added to the child entities through inheritance. the base is linked to the...

Nhibernate mapping: Encapsulating a list within an object.

I have two tables Deal and Cost. Costs can be of a number of types, eg Planned, Unplanned. Every deal can have one an only one of each type of cost. This is easy enough to map as a many-to-one on deal, reulting in an IList of Costs. But what I want is to create a costs object that has named properties for each cost. So that for a databas...

NHibernate classes as Data Contracts

I'm exposing some CRUD methods through WCF service, for some data objects persisted in a database through NHibernate. Is it a good approach to use NHibernate classes as data contracts, or is it better to wrap them or replace them with some other data contracts? What is your approach? ...

NHibernate Reflection Optimizer - what does it do?

I've found initializing my session factory is massively quicker whenever I disable the nhibernate reflection optimizer. This is great for testing purposes. <add key="hibernate.use_reflection_optimizer" value="false" /> My question is what is the knock-on effect of doing this, and why isn't it the default setting? Everything seems to...

How to setup a column that is an enumeration with Nhibernate?

Hi, using nhibernate, how would I setup a column to be an enumeration type? e.g. User class has UserType which is an enumeration public enum UserType { Normal = 1, Super = 2 } ...

Could not load file or assembly

I'm working on a system to use a SqlServerCe with NHibernate. From my driver program, if I add the System.Data.SqlServerCe assembly as a reference, I can create and run queries against a database just fine. When trying to use NHibernate, though, I get the following exception: A first chance exception of type 'System.IO.FileNotFoundExc...

How to use LINQ to retrieve child collection

Starting here: public class Customer { public int CustomerID { get; set; } public string CustomerName { get; set; } public IList<Order> Orders { get; set; } } public class Order { public int OrderID { get; set; } public int CustomerID { get; set; } } What would be the linq query that you write to retrieve all Orders from ...

Using nHibernate, how can I read uncommited?

Hi, Using nhibernate, how can I set the transaction level to read uncommitted? With SQL, I usually set the transaction level at teh beginning of my stored procedure or use inline (NOLOCK). ...

Eager loading child collection with NHibernate

I want to load root entities and eager load all it's child collection and aggregate members. Have been trying to use the SetFetchMode in FluentNHibernate, but are getting duplicates in one of the child collection since I have a depth of 3 levels. DistinctRootEntityResultTransformer unfortunately only removes the root duplications. ret...

Where to download the assembly that contains NHibernate.Caches.Prevalence.PrevalenceCacheProvider, NHibernate.Caches.Prevalence?

In the nhibernate doco is states that to use the prevalence cache use the provider class “NHibernate.Caches.Prevalence.PrevalenceCacheProvider, NHibernate.Caches.Prevalence” https://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/performance.html#performance-cache Where do I go to doanload the assembly that contains this typ...