nhibernate

NHibernate Enabling log4net

Hi, I have enabled log4net and run my app which is giving an exception. But the log file is empty. Doesn't NHibernate log info about the exception??? Malcolm ...

Nhibernate error: NO row with given identifier found error

Hi, I know that this question is repeated one. But no one could answer briefly enough to answer corrctly. I am getting Nhibernate error " No row with given identiifer found error" when im trying to use the guid to give me the record from the table. I am using Nhibernate load function to load the record with the unique identifier(GUID) ...

DDD, NHibernate, and Project Structure / Naming

What do you recommend as the proper project structure for a WebForms solution that is utilizing NHibernate and trying to bring in some DDD concepts? Assuming the root namespace and solution name is Sample Sample.Domain - contains my domain objects and my mapping files Sample.Repositories - contains my repositories and nhibernate...

How best to notify users of NHibernate exceptions when UnitOfWork is the entire request?

I'm currently using an Open Session in View pattern in an ASP.NET WebForms application (adapted quite a bit from Billy McCafferty's http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx). To oversimply state what goes on here: Open NHibernate transaction at beginning of request Commit at end of request (rolling back o...

Case-insensitive sort ordering in NHibernate

Consider the following criteria query: var x = SomeCriteria.AddOrder(new Order("Name", true)).List(); This will order the result set by the Name property, but case sensitive: "A1" "B1" "a2" Any ideas how to add the order case insensitive so result "a2" will end up before "B1"? ...

nhibernate entities with complex db tables

Hi i got a problem as shown at top.an Db desgin used with oracle is shown below.I want to devolop CRUD processeses for the entities that will be generated over this db diagram.I have to use nhiberante and hql queries.In the diagram relations are succeed over relatinal tables(unit-property relation is succeed over unitporperty table e.g...

Only get latest results using nHibernate

I have a nHibernate query like this ICriteria query = session.CreateCriteria(typeof(MyResult)) .Add(Expression.Eq("ResultTypeId", myResult.ResultTypeId)) Problem is that users add results all the time and I want to show a table of all the latest results for all the diferent ResultTypes I have. The MyResult class has a pro...

Nhibernate - Cannot fetch multiple collections in a single query

Hi, I have a entity Recipe and it has 3 collections images, comments and ingredients. The are mapped as a bag. For a website I want to load the recipe collections with the recipe ie not lazy load so I discovered I could do that using this query from Recipe r left join fetch r.Images left join fetch r.Ingredients left join fetch r.Comm...

Obscure NHibernate/Fluent NHibernate error.

Hi, I've been encountering the following error when trying to build a session factory: PersistenceTests.Can_Map_Orders_To_Database : Failed System.IndexOutOfRangeException: Index was outside the bounds of the array. at NHibernate.Mapping.Column.set_Name(String value) at NHibernate.Cfg.XmlHbmBinding.ClassBinder.BindColumns(XmlNode ...

bidirectional relationship patterns with nhibernate

In my domain, an Employee and a Department have a one-to-many bidirectional relationship; to let the child Employee synchronize this, I have an 'internal' access field for the Set (Iesi for NHibernate) of Employees that are in the Department, which would otherwise be readonly public. Like so: Department class: protected internal ISet<E...

Can I replace the call to Activator.CreateInstance() in NHibernate?

Is there a way to replace the call to Activator.CreateInstance() used inside NHibernate 2.0.1GA to construct the entities? Ideally I'd like to replace it with StructureMap.ObjectFactory.GetInstance(). ...

How to enumerate column names with NHibernate?

I've got a class with a bunch of [ColumnName("foo")] NHibernate attributes. Is there an easy way to ask NHibernate to list all of the ColumnNames for a given class? It sounds like it should be really easy but I'm just not seeing any kind of inspection in the NHibernate docs (or maybe I'm just blind today). ...

Where to put auditing or logging?

I'm currently working on an ASP.NET MVC project using NHibernate and I need to keep track of changes on some entities in order to be able to make some reports and queries over the data. For this reason I wanted to have the data in a table, but I'm trying to decide where to "hook" the auditing code. On the NHibernate layer: PRO: Powerf...

Integrating Nhibernate.Search with Nhibernate 2

I have just spent all day attempting to get NHibernate.Search working alongside NHibernate 2.0 and am sorry to say that I have still not managed it. I ran into the problem posted here and downloaded the dll linked by that post, however the example uses a search Interceptor rather than EventListeners, which I believe to be the newer way o...

NHibernate - Mapping same entity to many tables

Hi, I'm working on an application that has a data publication mecanism that I designed & implemented. It allows one master instance of the app to feed data to many subscriber instances. This is implemented by loading the master's data into a set of temporary import tables that have the same exact schema on the subscriber. The merge proc...

Fluent NHibernate Component Mapping - String DB Value passed to a factory yields the required object type

Table: CREATE TABLE Instrument ( Id INT IDENTITY , Name VARCHAR(50) , Tenor VARCHAR(10) //... Model: interface ITenor { int Length { get; } string ToString(); } class DayTenor : ITenor { public int Length { get { return 1; } } public overri...

.Net Full Text Search Library

I posted a question yesterday about using Nhibernate search with nhibernate v2 and have recieved no responses. This has confirmed to me that I need to reconsider using NHibernate.Search and look at an alternative full text search solution. I want to be able to index and search documents and display the relevant extracts of the documents ...

Mapping a ternary association with FluentNHibernate, using IDictionary<TKey,TValue>

I'm trying to map a ternary association using FluentNhibernate. I have 3 tables: TUser(PK int id, string name, ...) TGroup(PK int id, string name, ...) TRole(PK int id, string name, ...) And a 4th one that associates them, representing the ternary association: TUserGroupRole(FK int userid, FK int groupid, FK int roleid) Basicall...

NHibernate doesn't save object's collection of items

I've got an Order class that contains OrderItems. When I save the Order class, the database is populated with the Order information, but none of the child OrderItems are saved to their respective tables. Here's what the Order mapping looks like: <class name="Order" table="Orders"> <id name="OrderID" column="OrderID" type="Int64" unsav...

nHibernate logging during unit testings

I'm running unit tests from inside VS2008 against a nHibernate application and would like to turn on logging during the unit tests so I can see a bit more of what is going on. I've copied and pasted another application's app.config that successfully logs nhibernate information into the unit tests app.config, but still don't get any outp...