nhibernate

Linq2NHibernate - Only Left Joins?

Really quick question.. Does Linq2NHibernate always create a left join to retrieve relationships? Is there a way that I can get an inner one instead? Thank you in advance. Filipe ...

nhibernate 3.0 Oracle connection through ODP.NET

Can someone tell me whats wrong with the nhibernate config below? Using the latest ODP.NET version. <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" > <session-factory> <property name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property> <property name="connection.connection_string">DA...

Preventing duplicate tag names with many-to-many NHibernate mapping

I'm using NHibernate to persist my Item class to a SQL database. The Item class has a property Item.Tags of type ICollection<Tag> which I am mapping using the following NHibernate configation. <set name="Tags" table="TagLinks" cascade="all" lazy ="false"> <key column="ItemId" /> <many-to-many class="Tag" column="TagID" /> </set> A...

How to map property to first of many in Fluent NHibernate?

Given a parent child relationship between User and FailedLogin where a user has many failed logins. I'd like to map this into class User { public virtual FailedLogin LastFailedLogin { get; set; } } class FailedLogin { public virtual User User { get; set; } public virtual DateTime AttemptOn { get; set; } } So that the Las...

Foreign key is null when NH save the childs collection

I try to map NHibernate to an existing database structure. Unfortunately I can not change the existing structure. First I'll give some background and then explain the problem itself Relational analysis is quite simple: Log is the main Entity. he has one-to-one relationship with Form. the foreign key is FormID. Buyer & Seller are col...

NHibernate Delete with date arithmatic using HQL

Hello, I've looked around and can't find too much. But is it possible to do something like this using HQL in nHibernate: Session.CreateQuery(@"DELETE FROM MyObject mo WHERE (mo.AlteredDate + mo.ExpiryDetails.ExpiryTimestamp) < :pNow") .SetDateTime("pNow", DateTime.Now); So basically I want to...

NHibernate doesn't fetch all data (many-to-many associations)

Hi, I have a newbie problem with many-to-many association. I have the following: ServiceConsumer -> ConsumerWishes <- ParameterWishes For consumers I have this part of code: <set name="paramWishes" access="field" lazy="true" table="CONSUMERS_TO_WISHES" inverse="true" cascade="all"> <key column="CONSUMER_ID" /> <many-to-many colum...

Is there any NHibernate report generator?

Hi all, There are many report generators for MySql and MS SQL Server. For example this one for MySql. We have a large web application based on NHibernate and I'm wondering if there is any report generator that works on our NHibernate mapped entities? ...

[FluentNHibernate] Could not load file or assembly 'Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'

Hi! I'm using Microsoft Visual Studio 2010. I start to work with FluentNHibernate 1.1. After configuration.BuildSessionFactory() execute, i have exception. Message "Could not load file or assembly 'Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. Castle.DynamicProxy...

Whats new in NHibernate 3.0

With NHibernate closing on a 3.0 release, whats really changed and new in it? Any good resources for looking up the changes? ...

Modeling NHibernate queries

Usually I'd put my criterias/hql queries in a repository/dal class related to the entity, but lately I'be been thinking of adding another abstraction that represents what a query is, this would give me the possibility of adding common behavior to all queries (e.g. pagination) in a base class, etc. so these are my components now; generi...

Nhibernate mapping - Can a child hold a reference to its parent collection?

I am new to NHibernate and I'm trying it out by porting a small webforms app to use it. I am trying to figure out if its possible to map (hmb.xml maps) the following assignments: public class Foo { public List<Bar> Children { get; set; } public void AddBar(Bar b) { Children.Add(b); b.OwnerCollection = Childr...

Create a new record with an assigned PK - Castle ActiveRecord

I have a table with a GUID primary key. In ActiveRecord it is setup with a PrimaryKeyType.GuidComb. Is it possible to create this record with a manually assigned PK? If I set the primary key in the record and run Create() a new ID is assigned. If I run Save() I get an error (as one would expect). The why: This table is in two databa...

HasMany cause KeyNotFoundException on Delete

hi i'm new to nhibernate and i read a lot of threads with similar problems, but i dont get it working. i use oracle, nhibernate3 alpha and fluent nhibernate for mapping. i have a parent child relation. the child table has a composite id. Select, insert, update records works. Delete a parent without child records works. But deleting a par...

NHibernate .Query returning stale data

This is my unit test (it's quite meaningless but proves a point Config entity = new Config("key", "value"); Session.SaveOrUpdate(entity); Config config = Session.Query<Config>().SingleOrDefault(c => c.Key == "key"); Assert.IsNotNull(config); it fails...but I don't think it should (note, if I flush it, it doesn't fail, but that's ...

Nhibernate ManyToMany with a dynamic where clause

I'm having some issues mapping a complex many to many relationship in fluentnhibernate. I have a legacy db which looks something like this: Foos: | Id | Foo | FooBars: | FooId | BarId | Bars: | Id | Bar | CultureId | which I am trying to map to the following object model: class Foo { property virtual int Id { get; set; } prop...

NHibernate code genaration tool for asp.net (c#)

Hello Guys, Any idea of any tool I can use to generate asp.net (c#) scripts for NHibernate. I was told some come with unitTest Scripts as well. I just need a good template to start a project using NHibernate with C# web application. This a new territory for me Cheers ...

How to map composite-id with fluent nhibernate using an interface?

Hello, i'm trying to switch out .hbm mappings to fluent mappings an have a problem with the mapping of composite-ids and the usage of Interfaces the Class looks at follows: public class ClassWithCompositeId { public virtual IKeyOne KeyOne { get; set; } public virtual IKeyTwo KeyTwo { get; set; } } our hbm mapping looks like this...

NHibernate: Logging

Hi all. I want to disable logging for one property in nhibernate. I am logging all the nhibernate queries , but, when i insert a huge binary file, it logs all the bytes. So i want to log all the queries and params except the binary ones. Thanks. ...

Fluent NHibernate Hierarchical Data Question (One Table Per Hierarchy)

I am having some trouble depicting a DataBase Setup in NH. I have the following Classes: public class BaseData { public virtual long Id { get; set; } } public class ExtendedData : BaseData { public virtual string Name { get; set; } } The backing tables look like the following: BaseTable -------...