nhibernate

NHibernate MySQL Enum

I am trying to access the "MYSQL" database tables to create a GUI for adding users and privileges. Doing this, I have run into my first NHibernate problem. How do i map MySQL Enum's to a C# Boolean? Or if not possible then to at least a Enum? The database fields are delcared as enum('N', 'Y') These are all of the privilege fields i...

NHibernate MySQL Composite-Key

I am trying to create a composite key that mimicks the set of PrimaryKeys in the built in MySQL.DB table. The Db primary key is as follows: Field | Type | Null | ---------------------------------- Host | char(60) | No | Db | char(64) | No | User | char(16) | No | This is my DataBasePrivilege.hbm.xml fil...

Starting with NHibernate

I'm having major difficulties to start off with NHiberante. Main problems: Where my hbm.xml files should reside? I create a Mappings folder but I received an error "Could not find xxx.hbm.xml file." I tried to load the specific class through the dialect cf.AddClass(typeof(xxx)); but it still gives me the same error (the files are mark...

nHibernate HQL dynamic Instantiation question

Hello all, I can't find what's going on with the following nHibernate HQL. here's my VB.Net code: Return _Session.GetNamedQuery("PersonAnthroSummary").SetInt32(0, 2).UniqueResult() My Named Query: <sql-query name="PersonAnthroSummary"> select New PersonAnthroSummary( Anthro.Height, Anthro.Weight ) from PersonAnthroContac...

Fluent NHibernate - How to map a non nullable foreign key that exists in two joined tables

I'm mapping a set of membership classes for my application using Fluent NHibernate. I'm mapping the classes to the asp.net membership database structure. The database schema relevant to the problem looks like this: ASPNET_USERS UserId PK ApplicationId FK NOT NULL other user columns ... ASPNET_MEMBERSHIP UserId PK,FK App...

NHibernate - ISession vs. IStatelessSession

What is the pros and cons using IStatelessSession over ISession in NHibernate? ...

invoke sql function using nhibernate?

I want to query like this: select * from table where concat(',', ServiceCodes, ',') like '%,33,%'; select * from table where (','||ServiceCodes||',') like '%,33,%'; so, I wrote this code: ICriteria cri = NHibernateSessionReader.CreateCriteria(typeof(ConfigTemplateList)); cri.Add(Restrictions.Like(Projections.SqlFunction("concat", NH...

Can WCF Data Services or RIA Services be implemented with NHibernate?

From what I read on the internets, WCF Data Services seem to be bound to data access via Entity Framework on the server. Is there a way to have NHibernate access mapped in the same way? ...

NHibernate - auto generate timestamp on create and update ?

I am trying to map an entity in NHibernate, that should have an Updated column. This should be the DateTime when the entity was last written to the database (either created or updated). I'd like NHibernate to control the update of the column, so I don't need to remember to set a property to the current time before updating. Is there a b...

How can we enhance our serach performance in a large application that works with NHibernate?

How can we enhance our serach performance in a large application that works with NHibernate? ...

NHibernate MySQL Mapping Set Column Type

In my MySQL database, I have the following column type. Field | Type | Null | ---------------------------------- Column_priv | set('Select','Insert','Update','References') | No | And I cannot figure out what to map this to. Can anyone tell me how I can map this to something? ...

Using an interface for a subquery in NHibernate

I normally query interfaces using DetachedCriteria in NHibernate: DetachedCriteria crit = DetachedCriteria.For<IParent>(); And this works fine. I now want to create a subquery for a child object thus: DetachedCriteria subcrit = DetachedCriteria.For<IChild>(); and add it to the criteria like this (kind of, p.Child is actually an al...

NHibernate Use existing ConnectionStrings in app.config

I want to use the connection string App.Config file. Also is it possible to use NHibernate connect to 2 databases (different connection strings) if so how? ...

Calling Stored procedure using Nhibernate -- Getting exception No persister for:

here is code, how I am calling Stored procedure ISession session = NHibernateHelper.GetCurrentSession(); IQuery q = session.GetNamedQuery("ps_getProgressBarData1"); var t = q.List(); XML mapping <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="ReleaseDAL" assembly="ReleaseDAL"> <sql-query name="ps...

NHibernate + Remoting = ReflectionPermission Exception

Hi all, We are dealing with a problem when using NHibernate with Remoting in a machine with full trust enviroment (actually that's our dev machine). The problem happens when whe try to send as a parameter an object previously retrieved from the server, that contains a NHibernate Proxy in one of the properties (a lazy one). As we are i...

NInject2 Interceptor usage with NHibernate transactions

Hello, In my previous project we used NHibernate and Spring.NET. Transactions were handled by adding [Transaction] attribute to service methods. In my current project I'm using NHibernate and NInject 2 and I was wondering if it's possible to solve transaction handling using "Ninject.Extensions.Interception" and similar [Transaction] ...

How to determine one to many column name from entity type

I need a way to determine the name of the column used by NHibernate to join one-to-many collections from the collected entity's type. I need to be able to determine this at runtime. Here is an example: I have some entities: namespace Entities { public class Stable { public virtual int Id {get; set;} public virtual ...

How to add a SaveOrUpdateCopy event listener in NHibernate

How can I add a event listener for SaveOrUpdateCopy in NHibernate ? I see that the ListenerType enumeration does not have a 'SaveOrUpdateCopy' type. I tried using the 'Merge' type, but that adds it to the MergeEventListeners collection. The SaveOrUpdateCopy invokes the events from the SaveOrUpdateCopyEventListeners collection. How can I...

NHibernate MVVM Session Best Practice

What is the best place to store the NHibernate session if we only need one? In the main windows view model? In the app? In the DataAccess Class? ...

Mapping multiple foreign keys to one table

Hi I'm using Fluent Nhibernate, i need to create mappings for 2 tables: Simplified, they look like this: TAXI ( Id int primary key Name varchar ) ORDER ( Id int primary key RedirectedFrom int foreign key on TAXI.Id RedirectedTo int foreign key on TAXI.Id ) So, two foreign keys from table TAXI refer to table ORDER Q: Is tha...