77
votes
16answers
58k views

NHibernate.MappingException: No persister for:

Now, before you say it I DID google and my hbm.xml file IS an Embedded Resource. Here is the code I am calling: ISession session = GetCurrentSession(); var returnObject = session.Get<T>(Id); ...
65
votes
20answers
9k views

Are there good reasons not to use an ORM? [closed]

During my apprenticeship, I have used NHibernate for some smaller projects which I mostly coded and designed on my own. Now, before starting some bigger project, the discussion arose how to design ...
48
votes
1answer
19k views

Moq: Invalid setup on a non-overridable member: x => x.GetByTitle(“asdf”)

Not sure how I can fix this, trying to do a unit test on the method "GetByTitle" Here are my definitions: public class ArticleDAO : GenericNHibernateDAO(IArticle, int>, IArticleDAO { ...
45
votes
3answers
37k views

Best way to convert IList or IEnumerable to Array

I have a HQL query that can generate either an IList of results, or an IEnumerable of results. However, I want it to return an array of the Entity that I'm selecting, what would be the best way of ...
34
votes
3answers
27k views

How does TransactionScope roll back transactions?

I'm writing an integration test where I will be inserting a number of objects into a database and then checking to make sure whether my method retrieves those objects. My connection to the database ...
31
votes
2answers
15k views

nHibernate, No row with the given identifier exists

I have a mapping along the lines of this. <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Model.Entities" schema="etl" assembly="Model" default-lazy="false"> <class ...
30
votes
5answers
8k views

Override for fluent NHibernate for long text strings nvarchar(MAX) not nvarchar(255)

When ever you set a string value in fluent NHibernate it alwasy sets the DB vales to Nvarchar(255), I need to store quite a lot of long string which are based on user inputs and 255 is impractical. ...
29
votes
7answers
9k views

Identifying NHibernate proxy classes

I'm not an NHibernate user; I write a serialization utility library. A user has logged a feature-request that I should handle NHibernate proxy classes, treating them the same as the actual type. At ...
27
votes
1answer
9k views

How to configure fluent nHibernate with MySQL

I'm trying to configure nHibernate to use a MySql database. I found examples for mssql and sqlite but none for mysql. So, how do I change this so it uses mysql: Fluently.Configure().Database( ...
26
votes
8answers
11k views

Problem using SQLite :memory: with NHibernate

I use NHibernate for my dataacess, and for awhile not I've been using SQLite for local integration tests. I've been using a file, but I thought I would out the :memory: option. When I fire up any of ...
25
votes
3answers
9k views

How to configure Fluent NHibernate to output queries to Trace or Debug instead of Console?

How to configure Fluent NHibernate to output queries to Trace or Debug instead of Console? I'm using MsSqlConfiguration.MsSql2008.ShowSql() but it has no parameters and I can't find anything on ...
22
votes
2answers
5k views

Fluent NHibernate, working with interfaces

I just switched to Fluent NHibernate and I've encountered an issue and did not find any information about it. Here's the case : public class Field : DomainObject, IField { public Field() { ...
21
votes
5answers
3k views

NHibernate Transactions on Reads

I have read the documentation and explanation on why it is highly recommended to use transactions on read operations in NH. However, I still haven't totally "bought" into it yet. Can someone take a ...
20
votes
4answers
11k views

How to get a distinct result with nHibernate and QueryOver API?

I have this Repository method public IList<Message> ListMessagesBy(string text, IList<Tag> tags, int pageIndex, out int count, out int pageSize) { pageSize = 10; ...
20
votes
3answers
7k views

NHibernate Session.Flush() Sending Update Queries When No Update Has Occurred

I have an NHibernate session. In this session, I am performing exactly 1 operation, which is to run this code to get a list: public IList<Customer> GetCustomerByFirstName(string ...

1 2 3 4 5 278
15 30 50 per page