nhibernate

Is no HQL needed for Get, Update, Insert and Delete operations in NHibernate?

Are Get/Update/Insert/Delete all built in functions that work out of the box without having to write any HQL? I guess it gets this information from the mappings XML files? ...

nhibernate and lazy loading, just want 1 row from the collection

When using nHibernate and lazy loading, how would I get this kind of behavior: I have a Customer class, and the customer has many addresses. (say 100 to make this make more sense). I load my customer row, I want to just access 1 item from the addresses collection. I don't want nHibernate to load all 100 addresses, but with lazy loadin...

How to tell Fluent NHibernate not to map a class property

I have a class that is mapped in fluent nhibernate but I want one of the classes properties to be ignored by the mapping. With class and mapping below I get this error: *The following types may not be used as proxies: iMasterengine.Data.Model.Calendar: method get_HasEvents should be virtual* //my class public class Calendar : IEntity...

Simple Nhibernate is not work?

Dear All, I'm new in Hibernate word, I got some source code example about Nhibernate with C# code, It worked fine, But when I try to create a new console as their example, I got many error, and I can't solve. So I hope everybody in stacoverflow help me solve my issue. When I try to run my C# console hxxp://www.vi-vn.com/pubs/Forum.Im...

How to fetch an entity with its entity-properties in nhibernate?

Hi, I want to get an entity with its sub-properties. How can I do that with nhibernate without indicating in mapping. I want to control the fetching like we can do in linq-to-sql by "LoadWith()" method. Not an automated solution. public class Survey { public virtual long Id; public virtual String Title; public virtual IList<S...

When using nHibernate, who creates the class files?

I was under the impression, when using nHibernate, after you create the mapping xml files etc., all the plumbing for basic CRUD operations is done for you, along with the class files i.e. public class Employee { public virtual string Name {get; set; } } But I must be wrong here because there doesn't seem to be anything genera...

How can I page through data using nHibernate using a CTE?

Is there any example code someone can show me that will page through data in a given table, and use CTE's under the hood? Is nhibernate suppose to work across various databases out of the box? I am using MS SQL Server 2008 now, but what if the client wants to use Oracle someday? ...

defining enum types in a mapping file, or columns from another table

Hi, if my mapping file, how would I reference a C# enum type? what about columns from another table? ...

How can I get a DataRow from a NHibernate ISQLQuery query?

I need a DataRow with every column of a table T without the column Y, which holds the primary key. The SQL is: SELECT * FROM T WHERE Y=N LIMIT 1 "LIMIT 1" is a mysql dialect so that is the reason I need an agnostic ISQLQuery (query.SetMaxResults(1);) to do the work. I can get a row in the form of object[] using this code: ISQLQuer...

testing entity mapping of NHibernate

hello, i'm building some basic crud methods for my fluently mapped entities. i just wanna know if there is a simple way to make the transaction to perform a rollback when i'm running the cud test methods ? the code that being tested perform the commit inside here is a create sample: public int? Create(IIdentifiable entity) { ...

WCF and Fluent NHibernate: how can i keep "clean" classes?

Hello everyone, i'm investigating Nhibernate, jquery and WCF at the same time for a in-house project, and i was wondering why i couldn't have "clean" data classes. From what i've read, a very good point in the nhibernate world is that my business class won't be linked to the framework. I won't have <SaveInTable("Thingie")> _ Public C...

How to make Nhibernate generate table with Text field instead of nvarchar(255)

I'm trying to make NHibernate generate my schema/SQL 2008, and using the mapping below it keeps wanting to create an nvarchar(255) column instead of text...any ideas? <property name="AnnouncementText" column="AnnouncementText" type="StringClob"> <column name="AnnouncementText" sql-type="NTEXT"/> </property> Thanks! ...

Is it possible to create a database using NHibernate?

I am using NHibernate with FluentNHibernate for my DAL. I am also using SchemaExport and/or SchemaUpdate to create and update my database schema. My problem is that the schema operations all require the database to exist before they will work. I want to programmatically create my database and update the schema as there may be multiple d...

NHibernate caching on unique indexes?

I have a few classes which have a property which is unique to that object, for example for the User class the property Username should never be duplicated. NHibernate doesn't seem to support loading of an object by unique key which is then cached in the same way that Load() or Get() does. Am I correct when I say that? If I am then I wi...

NHibernate COALESCE

Hi! Is it possible to translate this sql-statement to a CreateCriteria and second does NHibernate deals with ORDER BY COALESCE? SELECT obs1.OBSLOPNR, obs1.LOKALLOPNR, obs2.OBSLOPNR, obs2.LOKALLOPNR FROM (SELECT * FROM OBS WHERE OBS.LOKALLOPNR = 9) AS obs1 FULL OUTER JOIN (SELECT * FROM OBS WHERE OBS.LOKALLOPNR = 8) AS obs2 ON o...

How should I design my datalayer so I could potentially swap out nHibernate with linqToSql?

So I'm going with nHibernate, but want to design my datalayer so I could potentially swap out (or switch) to a linqToSql layer. How should I go about designing this? Should I make an interface that has all my database calls? Something like this? GetUser(); InsertUser(); ...

What is the difference between llblgen and nHibernate?

What are the key differences between llblgen and nHibernate? ...

differences between nhibernate 1.2 and 2.0

I can't seem to find any information on what the actual differences are between nhibernate 1.2 and 2.0. I have found information regarding what the potential issues are with upgrading, but nothing on what new features are included, or anything about performance differences. If there are significant differences between the two that coul...

Using nHibernate, how do you lay out your files in a VS.NET solution?

Using nHibernate, (and the repository pattern), how do you go about laying out your files/folder? I am going to to DDD, and use the repository pattern so I will have lots of classes that map to my database tables, and lots of repositories that inherit from an interface etc. Something like: /root/ /root/web.config /root/class/user.cs ....

NHibernate mapping with strings, no real foreign keys.

I've got a class "Lab" which represents a Department of a company that uses my program. It's got a child collection called "Employees" which is meant to contain all the Employees that belong to that Lab. The employee table contains a string field called "Department" which represents which department they belong to, and the Lab table cont...