nhibernate

Fluent NHibernate: How to Map M:N many-to-many with composite keys on both sides

OK, so here is the problem. Its not even as crazy as the guy who wants to map m:n with different column counts in his PKs. No matter what I do or where I look there seems to be no method chain that will result in a successful mapping of this. I have tried doubling up on the Parent and Child columns, eg ParentColumn("").ParentColumn(""...

How to suppress logging message for nHibernate

I am using log4Net in my application which also uses nHibernate. Now my eventlogger is flooded with nHibernate messages which I want to suppress. I have tried this but it did not work. <log4net> <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender"> <param name="LogName" value="App Log" /> <param n...

What's wrong with this NHibernate mapping file?

I am getting a cannot load entity error because of {"Incorrect syntax near the keyword 'File'."} Here is my mapping file. I'm assuming I am not escaping something properly but I don't see what. I don't think it's my PreApplication.File table name. Thanks in advance!! <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="...

Is there a Query-Mapper like iBATIS.NET but with dirty tracking, lazy-loading and cascading updates?

The problem: A DBA-controlled database with a Stored Procedure-only mandate. An expectation that the domain be defined in POCO's. So I decided that I need an ORM designed for stored procedures and/or legacy databases. Ideally the ORM should allow me to declaratively (or fluently) map domain objects to CRUD stored procedures. Some f...

Fluent NHibernate Many-to-many mapping with auto-generated pk instead of composite key

I'm working on a RoleProvider in .NET, using Fluent NHibernate to map tables in an Oracle 9.2 database. The problem is that the many-to-many table connecting users and roles uses a primary key generated from a sequence, as opposed to a composite key. I can't really change this, because I'm writing it to be implemented in a larger exist...

Considerations for implementing LINQ to SQL or Entity Framework now, intending to use NHibernate later

I've got a deadline for an initial release of a client-server application that will have lots of iterative releases subsequently. NHibernate is the ORM of choice, largely by reputation and my desire to gain experience with it. The problem is that I haven't even had a chance to spike NHibernate yet, and I'm afraid that doing so is going...

CodeCampServer don't input any logging from NHibernate?

Are you ever succeed input NHibernate logging using CodeCampServer architecture? I read this and I did everything that I can. Maybe there is know problem in this architecture. I using Infrastructure.NHibernate.DataAccess.Bases.Logger.EnsureInitialized(); to initialize log4net. here the code: public class DependencyRegistrar { pri...

NHibernate will save, but won´t load an entity

Hi! I´m receiving a very strange error with NHibernate 2.1.2.4000 GA and latest version of FluentNHibernate. I can save an entity but can´t load it back after a call to Flush() and Clear(). This is my entity: public class Application { public int Id { get; set; } public string Name { get; set; } public string KeyName { get; set; }...

fluent nhibernate automap version column

Current code in my convention: public void Apply(FluentNHibernate.Conventions.Instances.IVersionInstance instance) { instance.Column("RowVersion"); instance.Not.Nullable(); instance.UnsavedValue("0"); instance.Default(1); } This doesn't render the RowVersion as a version column. It treats Ro...

Fluent NHibernate is trying to convert my GUID primary keys to numbers when querying.

Hi, I'm observing some strange behavior whilst trying to perform a query on an NHibernate entity. The primary key of my object is a string (guid), but when I pass in the guid string I wish to query by, I get an exception, NHibernate.ADOException: could not execute query System.FormatException: Input string '6eaa591f-bb75-4c0b-8acb-...

How to set default access to field.camelcase-underscore using Fluent NHibernate?

would like to set this convention up globally if possible. ...

What will be the benefits of NHibernate in a data retrieval only scenario?

Hi All, We have been suggested to use NHibernate for our project. But the point is our application will only be retrieving the data from the database so are there any benefits of using NHibernate in this scenario? One more thing, what is the query execution plan in NHIbernate does it support something like prepared statements or the so...

Using Stored Procedure for reading records from Database in NHibernate?

Hi, Is reading the database records from the Database using Stored Procedures in NHibernate a good approach?If yes then why or if No, then also why? The application has only the feature of reading values from the database using NHibernate in the data access layer no updates and no inserts just only retrieval. ...

I want generate INSERT which include my Primary Key (not generated) by NHibernate. How to map Id column for this?

I have table CUSTOMER where CUSTOMER_ID is primary key. Table CREATE TABLE [CUSTOMER]( [CUSTOMER_ID] [int] NOT NULL, [START_DATE] [varchar(30)] NOT NULL, CONSTRAINT [PK_CUSTOMER] PRIMARY KEY CLUSTERED ( [CUSTOMER_ID] ASC ..... Mapping public class CustomerMap : ClassMap<Customer> { public CustomerMap() { With...

NHibernate.Linq returning the wrong type

Hi, I'm attempting to use NHibernate.Linq to return objects deep from my object graph, and for some reason NHibernate is returning the root object. I don't know if I'm missing something, or if it is just a problem with NHibernate.Linq. The compiler correctly infers that I am trying to return an object of type FacilityInstruction when ...

NHibernate and hilo generator: how to design key-tables?

I'm about to switch some of my entities from identity to hilo id-generator. I'm don't have a clue how the tables holding the next-high values should be designed. should I use a single table for all entities, or for a group of related entities? should I use another table for each entity? should I use a single table with another row or ...

Fluent NHibernate delegate mapping Func

Given this (HORRIBLE) object graph that I can't change public class Email { public Email(string email) { ... } //DO a bunch of worthless stuff } public interface IPerson { Email Email{get;set;} } Does something like this exist? Map(p => p.EmailAddress).Use(s => new EmailAddress(s)); Essentially the Person interface won...

NHibernate Mapping (Attributes) : KeyProperty not persisted

Hi, In my current project, Workflows have comments. Please have a look at the following code. [CompositeId] [KeyProperty(1, Column = "datum", Name = "Date", TypeType = typeof(DateTime))] [KeyManyToOne(1, Column = "workflow_id", Name = "Workflow", ClassType = typeof(Workflow))] public virtual IWorkflow Workflow { get; set; } ...

Fluent NHibernate Mapping not on PK Field

I have the following tables and cannot edit their structure... Person ------ Id PK Code Name Order ----- Id PK Person_Code OrderDetails Now in my Person class I want to have a list of Orders for that person, but I'm not entirely sure how to go about setting up the mapping in fluent nhibernate to match on the Code column rather than t...

NHibernate property access strategy, How to set it up so that field.camelcase-underscore is preferred but autoproperty is fall back.

I want to set up the access strategy so that if a field.camelcase-underscore property backing is present then use that else use the automatic property. is this the default behavior (since auto props have back fields essentially)? or how to I enforce this? ...