nhibernate

How to deal with NHibernate parent\child relationship with childs in ISet and generated IDs?

Having entered the world of NHibernate less than one year ago, I'm still developing my "personal" best practice and architectural solutions in this area... now I'm facing a pretty simple issue on which I'd like to have opinions or suggestions by somebody with more expertise. The scenario is the following: A straight parent/child relatio...

How do you set up NHibernate to use a Stateless session using Spring.Net?

Hello, I am currently developing an application that reads a bunch of data from a file. The usual size of the batch of objects to be inserted in the db is around 40.000 objects. So far we have used Spring.Net and NHibernate for our development and I'd like to be as consistent as possible and use the same technologies for the bulk insert...

How can i add some sql to all querys in NHibernate

I want a version control system and therefore all querys must add a piece of sql In place for the current record shows. But what place, can i add that piece of sql to all querys ? or could i do it with events? ...

Where to find NHibernate Jet driver

Hi, I don't know if it's just me, but I just can't seem to find the NHibernate Jet driver anywhere. I have not yet looked into the source, but looking at the main project files or the NH Contrib files, did not give me any results. Enough time wasted, who can show me the way? Thanks! ...

NHibernate: Adding an entity to a lazy loaded many-to-many relationship

We have a entity with a many-to-many collection mapped as a lazy loaded bag. When we load up the entity, the collection is not loaded - great. Now we want to add a new entity to that collection. As soon as we do this, the collection is loaded up. How do we add the new entity without loading up the whole collection (the collection is lar...

NHibernate, Pivot-table and/or GetNextID()

Can I use pivot tables with NHibernate? Can I write ID id = new Transaction().GetNextID("[TableName]", "[IDColumnName]")-like codes to increment IDs with NHibernate? ...

How to use Dynamic Instantiation with ICriteria in Nhibernate?

I know that you can do this easily with HQL using the following syntax: "select new ItemRow(item.id, item.name) from ..." In this example, the ItemRow need not be a persistent class that has its own mapping class. But how can we accomplish the same using ICriteria? ...

Properly mapping a polymorphic relationship with NHibernate

I am trying to create a table-per-hierarchy mapping using NHibernate 2.0.1. I have a base class with properties that exist for each subclass that other classes inherit from. All of these objects are persisted to one table called Messages that contain all of the possible fields for each class. There is a SourceID which is the discriminat...

FluentNHibernate / NHibernate Legacy Mapping problem

Given the following Tables and classes.... I want to know how to Map class Bs reference to A. It doesn't have a direct reference in table B, but comes from A having a reference to it. B only ever has 1 A that will have a reference to it. Can it be done? :) table A int id int bID table B int id class A { virtual int id { get;...

How to bulk delete with nhibernate?

Hi, How can I delete items with nhibernate without first pulling all the objects in memory? Is this possible or do I have to use raw sql? ...

NHibernate ManyToMany CreateCriteria

I have 3 classes: Mail,MailHeader,User Mail has 2 properties: User and MailHeader MailHeader has IList of Users (MailsDeleted) Now i want all mails of a specific user, only if the property MailHeader.MailsDeleted does not contains that user In other words with Linq i use: var q = from sa in candidates wh...

configure Fluent NHibernate mapping to allow INSERT only?

I'm moving a project from SubSonic to NHibernate and am using Fluent NHibernate to perform all of our mapping. Our db schema is pretty straight forward and most of our cases appear thus far to be well illustrated by different blog posts and sample code that's available. One thing that I'm unable to figure out however is the ability t...

Nhibernate- Lazy Load initialization fail

Hello All i am facing a problem.I have a 2 Model projects and ProjectChangeRequest. one project have multiple change request. Now on Nhibernate mapping xml file i have taken class like this in Project <class name="Project" table="project" lazy="false"> <id name="ProjectID" column="ProjectID"> <generator class="native" /> ...

getdate() through fluent nhibernate

Hi, I want to insert a record through fluent, where a column need to have the value of getdate() sql function. How to do this in a single fluent save function? Thanks, ...

NHibernate - How to find if a referenced object can be deleted?

I have an object called "Customer" which will be used in the other tables as foreign keys. The problem is that I want to know if a "Customer" can be deleted (ie, it is not being referenced in any other tables). Is this possible with Nhibernate? Thanks ...

what sources of information / videos do you use to learn new techniques for webdevelopment with C# ?

I work at a company that makes the move from php to .net. Now i am searching for good video sources to learn new techniques. We have already a license for www.tekpub.com great site but already have seen a lot of movies and will check other video sources too what video sources do you have or do you know ? ...

Nhibernate: problem eager loading two child collections (one being a component list)

i have a Parent class that has two child collections ChildCollectionA and ChildCollectionB. ChildCollectionA is mapped as an association, and has its own ID: HasMany(parent => parent.ChildCollectionA ) .KeyColumn("IDParent") .AsBag().Cascade.AllDeleteOrphan(); and ChildCollectionB is mapped has a co...

How do a case-insenstive Where clause in LINQ-to-NHibernate with the Oracle provider?

For example, given the following code, how is it possible to make the string comparison case-insensitive? var query = from employeeGroup in _session.Linq<EmployeeGroup>() from employee in employeeGroup.Employee where employee.UserName == username select employeeGroup.Em...

Using Time columns with NHibernate, Fluent NHibernate and SQL Server 2008

Hello, I have a table with a time column in my SQL Server 2008 database. The property of the object I'm trying to map to is a TimeSpan. How can i tell FluentNHibernate to use the TimeAsTimeSpan NHibernate type, so that I don't have cast problems? ...

Can NHibernate tell me which properties of an object have changed?

Is it possible to find out what has changed when an object has been updated in Nhibernate? Thanks. ...