nhibernate

Nhibernate Tag Cloud Query

Hi, This has been a 2 week battle for me so far with no luck. :( Let me first state my objective. To be able to search entities which are tagged "foo" and "bar". Wouldn't think that was too hard right? I know this can be done easily with HQL but since this is a dynamically built search query that is not an option. First some code: p...

Advantages and Disadvantages of NHibernate

What are the advantages/disadvantages of using NHibernate ? What kind of applications should be (& should not be) built using NHibernate ? ...

Nhibernate Criteria: 'select max(id)...'

Can I use a Criteria to execute a t-sql command to select the max value for a column in a table? 'select @cus_id = max(id) + 1 from customers' Ta Ollie ...

type fidelity using WCF/WPF over internet

We are trying to come up with an architecture approach for designing an application where front end runs as a browser based xaml app. this app contacts services on the web server that are built using wcf, the wcf services host domain model that uses nhibernate for persistence (so it is hibernate aware by using interfaces for lists and s...

Enumerations in the database and O/RM

Suppose I want entries in the table Regions to have a type, e.g. a city, a country etc. What's the accepted way of storing this type, assuming I'll be using O/RM (NHibernate in my case) ? I see two options: Have an enum in the C# bussines layer with the types and store the type as a tinyint in the table. Have a lookup table RegionType...

NHibernate HybridSessionBuilder, how to switch hibernate cfg based upon url values

I am using the HybridSessionBuilder supplied by Palermo and his team .. link .. We have our staging environments set up so that the url will be one of the following based on the environment web-test.company.com web-cert.company.com web.company.com what we normally do is take a look at the url and if it has "-test" we use the test co...

dynamic ordering with nhibernate

Say you have a table named Articles. It has the following columns: ID, name, body, created, modified, pageviews, etc. Using a single method, would it be possible to pull a list of articles, and pass it which column I want to order by? And also the direction, i.e. desc or asc. ...

NHibernate first level cache and Transaction Management between TransactionScope and NHibernate ITransaction

My development group is about to release a version of an internal framework that uses NHibernate (and Spring.NET) for persistence. Developers currently using our internal framework use ADO.NET for persistence, so going forward they will use a combination of ADO.NET and NHibernate. During testing of the NHibernate, we found out that the N...

NHibernate NonUniqueObjectException when reattaching objects to the session (with Lock)

Basic order of execution: A collection of PersistentObjects is queried then cached separately from the session. The collection is passed to a module that needs to reattach them to the session in order to lazily load some of the properties (using session.Lock(obj, LockMode.None)). After the module has completed processing, another modul...

nhibernate and sessions, please clarify

Hi, I am building a web application, and whenever I make a database call I need a session. I understand creating a session object is very expensive. I am following the repository pattern here: http://blogs.hibernatingrhinos.com/nhibernate/archive/0001/01/01/the-repository-pattern.aspx He uses something called a UnitOfWork to get the ...

does fluent handle the configuration also or I still need configuration.cfg.xml

Hi, I am using fluent for mappings in my web application that uses nhibernate (just setting it up!). Do I use fluent for the database configuration file or I use fluent for that? ...

nhibernate not taking mappings from assembly

Hi I'm using fnh and castle nhib facility. I followed the advice from mike hadlow here: http://mikehadlow.blogspot.com/2009/01/integrating-fluent-nhibernate-and.html here is my FluentNHibernateConfigurationBuilder: public Configuration GetConfiguration(IConfiguration facilityConfiguration) { var defaultConfigurationBuild...

NHibernate not loading one to many children

Yo i have the following nhibernate class: public class User { public virtual int Id { get; set; } public virtual string FullName { get; set; } public virtual IList<RatingItem> RatingItems { get; set; } public User() { RatingItems = new List<RatingItem>(); } public virtual void AddRatingItems(R...

Fluent NHibernate MappingException : could not instantiate id generator

I'm pottering around with Fluent NHibernate to try and get a simple app up and running. I'm running through this Fluent NHibernate Tutorial. Everything seems to be going fine and I've created the required classes etc. and it all builds, but when I run the test, I get an exception. Someone in the comments section of the tutorial has t...

Nhibernate many to one mapping with separate table ?

I've recently started using NHibernate and have very little experience. I have table Projects which can't be changed since it's a part of older system. I need to add ProjectGroup table represeting group of project, so that one project is assigned to only one particular group and group can have many projects assigned to it. I wonder if ...

How can I set a Property using NHibernate Mapping column using some crtieria

I want to specify a column of my domain object which will be of Type Product lets say. Instead of this being a normal relationhip like one to one for example or one to many etc... I want this property to be a product, but also it is the most sold product. So if I have an Object called ProductCategory public class ProductCategory{ ...

Why is nhibernate looking in /bin/debug for the hibernate.cfg.xml?

Hi, I have a class library with all my nhibernate code (domain/mappings using fluent). Now I am just doing some simple tests in a console application, and I am getting an error saying it can't find the configruation file in /bin/debug I have the file in /consoleTests/hibernate.cfg.xml Why would it be looking in the /bin/debug folder...

nhibernate says 'mapping exception was unhandled' no persister for: MyNH.Domain.User

Hi, I am using nHibernate and fluent. I created a User.cs: public class User { public virtual int Id { get; set; } public virtual string Username { get; set; } public virtual string Password { get; set; } public virtual string Email { get; set; } public virtual DateTime DateCreated { get; se...

NHibernate Partial Update

Is there a way in NHibernate to start with an unproxied model var m = new Model() { ID = 1 }; m.Name = "test"; //Model also has .LastName and .Age Now save this model only updating Name without first selecting the model from the session? ...

nhibernate 'save' -> 'get' problem

HEllo, I'm using nhibernate and have problems regarding user registration on my site. When user wants to register I create new user record in the database and immidiatelly after that the system is logging the user in. Well here lies the problem... When creating user record I'm using NHibernateSession.Save(entity); //does not saves u...