nhibernate

Does Fluent-NHibernate support mapping to procedures?

I've been wondering if it's possible to have Fluent-NHibernate communicate with stored procedures that already exist and assign mapping from the result set to my own domain objects. Also is Fluent-NHibernate able to directly execute procedures with no result set returned? Basically I've been considering the implications of using Fluent...

WCF + NHibernate + ISession = ?

Hi, I'm a beginner concerning both WCF and NHibernate. However, I have to do a little project involving several services (made with WCF) and a persistent layer (made with NHibernate). My problem concerns the usage of ISession and ISessionFactory. I have read (and seen) that the instantiation of ISessionFactory is very heavy (and thread...

Fluent NHibernate - how to map a subclass one-to-one?

Suppose I have three classes. It is valid to instantiate A, but there are also special cases B and D which subclass A, adding additional information. How would I do the mapping files for this in (fluent) NHibernate? public class A { public int ID { get; set;} public string CommonProperty1 { get; set; } public string Common...

Nullable Property Causes Errors When Null in NHibernate

I have a property defined in my HBM file like this: <property name="OwnerId" column="OwnerID" type="System.Int32" not-null="false" /> It is defined as a nullable field in the database also. If a record in the DB has the OwnerID column set to an integer, this object is correctly loaded by NHibernate. But if the record has it set to n...

NHibernate IInterceptor implementation(add properties to DB table that original domain class doesn't have)

How is possible to set some special column values when update/insert entities via NHibernate without extending domain classes with special properties? for example: in my case i would like to get object and just moment before update/insert db add to that object some additional information (like user id or computer name) by using IInterce...

Linq to NHibernate project status? Contributing? Lead?

Anyone knows what is the status of the Linq to NHibernate project? Is it in any kind of "production"? Cannot find the project site (bug reports, feature requests, people etc.), so that I could try to contribute? The latest post I was able to find was about Linq to NHibernate in LinqPad, and some Ayende's posts back from 2007... ...

How to delete child object in NHibernate?

I have a parent object which has a one to many relationship with an IList of child objects. What is the best way to delete the child objects? I am not deleting the parent. My parent object contains an IList of child objects. Here is the mapping for the one to many relationship: <bag name="Tiers" cascade="all"> <key column="mismatch_id...

NHibernate: Criteria expression to retrieve non-null one-to-one associated class

I have two classes that are associated with a one-to-one mapping: <class name="Employee" table="Employees"> ... <one-to-one name="Address" class="AddressInfo"> ... </class> I would like to use a criteria expression to get only Employees where the the associated Address class is not null, something like this (which I know doesn't...

How to handle authorization when using NHibernate in .NET

I'm using the repository pattern to query our database using NHibernate. It makes it really easy to do things like: public T GetById(int id) {...} But that doesn't help much when someone start mucking with the querystrings to see things they aren't allowed to. To compound it, some objects are deeply nested children of the parent obje...

Any Rhino Commons Getting Started Tutorials?

There used to be a great one at this blog: http://www.hanneyetc.co.uk/ but it is offline now. ...

Not-Null constraints in POCO Objects

I am currently writing an financial application, and we have a pretty standard customer table. It consists of many mandatory fields, and some optional like Cell/Fax etc.. I'm using NHibernate as a ORM and have all the mappings right. It already works. I just wonder, how do I "express" in code that a field is not-null without commenting?...

Joining NHibernate Classes that share a common column but no foreign key

I have a couple of tables that I want to map to classes. The tables look like this: Asset --------- AssetId AssetName Product --------- ProductId ProductName AssetId Disposal --------- DisposalId AssetId DisposalDate Basically what I want to do is join the Product Table to the Disposal table on AssetId so that my Product has a colle...

How can I express this in HQL

I've been stuck with this query for some time now. The SQL returns the result that I want, but I cannot work out how to express the query in HQL. Here's the SQL: select thread.ThreadId, thread.Title, thread.CreatedOn, thread.ViewCount, thread.CreatedBy, thread.ForumId from Threads thread where (...

NHibernate - creating records in related tables...

Hibernate version: 2.0.1GA I'm trying to add a single record in two tables. The tables are related. I have a beginner's knowledge of NHiberate so I'm hoping there's a better way to do this. Presently, I am under the belief that the only way I can get the ID of a newly-added record is to perform a SaveOrUpdate; then the object's ID fi...

Mapping a class with multiple collection properties containing the same object type

Our system generates emails with user-chosen lists of To / CC / BCC contacts. I wanted to store them as follows in our SQL Server database, here's the simplified database table structure: CREATE TABLE [Contact] ( [ContactID] [int] IDENTITY (1, 1) NOT NULL, [Name] [varchar] (100) NOT NULL, [EmailAddress] [varchar] (100) NOT ...

NHibernate - Is there any good tools to assist you with the configuration file?

Is there any GUI-based tools to assist you with writing and maintaining the configuration file? Any code tools to codegen the config file? What are the best ways to make this a little bit easier? Are most people just using Castle ActiveRecord now? ...

How to prevent writing object changes to the database on Flush with Castle ActiveRecord / NHibernate

The default behavior of NHibernate is the write all changes to objects to the database when Session.Flush() is called. It does this whether you want it to or not. How do we prevent writing bad data to the database when we need to do things like validate business rules or input? For instance .. Customer Name is not null. User opens ...

Fluent NHibernate: How to create one-to-many bidirectional mapping?

Hi, Basic question: How to I create a bidirectional one-to-many map in Fluent NHibernate? Details: I have a parent object with many children. In my case, it is meaningless for the child to not have a parent, so in the database, I would like the foreign key to the parent to have NOT NULL constraint. I am auto-generating my database f...

NHibernate - good complete working Helper class for managing SessionFactory/Session

can anyone provide/refer a proper OO type helper class for managing a singleton of the SessionFactory and then also for managing Sessions? ...

How to deal with a Many-To-Many Relation in my API

I have two entities Foo and Bar with a Many to Many relationship between them. Let's say there is no semantic argument for why Foo might be "responsible" for the many to many relationship, but we arbitrarily decide that Foo is responsible for the relation (I.e., in NHibernate we would mark Bar as Inverse) That's all well and good from ...