nhibernate

problem with NHibernate and iSeries DB2

Ok So I have an AS400/iSeries running v5r4. I have an application that was using classic NHibernate to connect and do some basic crud. Now I have pulled that app (which sat for 2 years) off the shelf of TFS and onto a new PC and cannot seem to get it running. Here is my Hibernate Config: <hibernate-configuration xmlns="urn:nhibernate-...

NHibernate query against the key field of a dictionary (map)

I have an object model where a Calendar object has an IDictionary<MembershipUser, Perms> called UserPermissions, where MembershipUser is an object, and Perms is a simple enumeration. This is in the mapping file for Calendar as <map name="UserPermissions" table="CalendarUserPermissions" lazy="true" cascade="all"> <key column="Calendar...

nhibernate mapping attributes vs fluent nhibernate

Do mapping attributes offer the same versatility as nhib hbm's do? Can you use them together with FNH to handle things FNH doesn't yet do as well as hbm's can? Cheers, Berryl By mapping attributes, I don't mean hbm files; there are apparently attributes that come with NHib (or maybe NHib contrib these days) that you use to decorate you...

FluentNhibernate many-to-many mapping - resolving record is not inserted

Hi, I have a many-to-many mapping defined (only relevant fields included) with FluentNHibernate (v1.0.0.637): // MODEL: public class User : IPersistentObject { public User() { Permissions = new HashedSet<Permission>(); } public virtual int Id { get; protected set; } public virtual ISet<Permission> Permissions { ...

Is saving an entity with a component collection supposed to do a SQL DELETE then INSERT using NHibernate?

I have an entity, TrackLog that has a component collection of TrackPoints. I create a new TrackLog and add some Trackpoints to it and save it to the DB. When I grab my TrackLog again and add a new TrackPoint, instead of doing one SQL INSERT like I expect, it's doing a DELETE on all the TrackPoints associated with the TrackLog and then r...

Is NHibernate overkill for small applications?

In a sense NHibernate seems convenient because it leads to less typing, and then propably less errors. ...

NHibernate FetchMode

Hi All, I have an object Parent which has a list of Children: class Parent {Id, Name, IList children} class Child {Id, Name} I need to select all parents where there is a condition for their children but I do not want to get duplicate rows (don't want the children details to appear in select list) Here is the code: session.CreateCr...

NHibernate lazy properties behavior?

I've been trying to get NHibernate into development for a project I'm working on at my workplace. Since I have to put a strong emphasis on performance, I've been running a proof-of-concept stress test on an existing project's table with thousands of records, all of which contain a large text column. However, when selecting a collection ...

NHibernte Left Join - in the join condition please help me

<property name="MId" column="M_Id" update="false" insert="false" /> <many-to-one name="MGH" class="MGH" lazy="false"> <column name="M_Id" /> </many-to-one> <join table="SXX2"> <key column="Study_Key" /> <property name="GG" column="GG"/> </join> i want to join the SXX2 table with left join please help me. ...

NHibernate IQueryable collection as property of root

I have a root object that has a property that is a collection. For example: I have a Shelf object that has Books. // Now public class Shelf { public ICollection<Book> Books {get; set;} } // Want public class Shelf { public IQueryable<Book> Books {get;set;} } What I want to accomplish is to return a collection that is IQu...

ASP.Net MVC 2 is it possible to get the same instance of model(with slight changes) in HttpPost method, that was passed in HttpGet

Hi I have a complex entity User: public class User : BaseEntity { public virtual Taxi Taxi { get; set; } --> That is why i call it "complex" public virtual string Login { get; set; } public virtual string Password { get; set; } } where Taxi is a parent of User (Taxi has-many Users): ...

NHibernate Transforms and mapping

I have a stored proc that returns me a set of data and I am using the DistinctRootEntityResultTransformer to return that data as a tree. You can see an example of this here: http://ayende.com/Blog/archive/2009/08/28/nhibernate-tips-amp-tricks-efficiently-selecting-a-tree.aspx Is there a way to specify this in the mapping instead of wi...

FluentNHibernate: multiple one-to-many relationships between the same entities.

Hi, I'm working on a bug tracking application. There are tickets, and each ticket has an opener user and an assigned user. So, basically, I have two entities, which have two many-to-one relationships with each other. Their schematic is this: User: public class User { public virtual int Id { get; protected set; } ... publi...

Fluent Nhibernate and hbms

As an FNH user, do you find you sometimes need to supplement FNH with an hbm file? Any relatively common edge cases where you do, if so? Cheers, Berryl ...

(N)Hibernate: deleting orphaned ternary association rows when either associated row is deleted.

I have a ternary association table created using the following mapping: <map name="Associations" table="FooToBar"> <key column="Foo_id"/> <index-many-to-many class="Bar" column="Bar_id"/> <element column="AssociationValue" /> </map> I have 3 tables, Foo, Bar, and FooToBar. When I delete a row from the Foo table, the assoc...

NHibernate LINQ query throws error "Could not resolve property"

I'm testing out using LINQ with NHibernate but have run into some problems with resolving string.length. I have the following public class DC_Control { public virtual int ID { get; private set; } public virtual string Name { get; set; } public virtual bool IsEnabled { get; set; } public virtual string Url { get; set; } ...

Write subquery in Criteria of nHibernate.

I read about subquery in Criteria, but I am still unable to grasp it properly. So, here I am taking one example and if somebody can help me writing that using subquery it will be great. Lets say we have table Employee{EmployeeId.(int),Name(string),Post(string),No_Of_years_working(int)} Now I want all the employees who are Managers a...

NHibernate GenericADO Exception

Hi, I'm trying to make simple many-to-one association, using NHibernate.. I have class Recruit with this mapping: <class name="Recruit" table="Recruits"> <id name="ID"> <generator class="native"/> </id> <property name="Lastname" column="lastname"/> <property name="Name" column="name"/> <property name="MedicalReport" column="medicalRep...

Fluent NHibernate ExportSchema without connection string

I want to generate a database script without having an actual database connection string declared. To do this for now i use NHibernate ExportSchema bases on a NHibernate configuration generated with Fluent NHibernate this way (during my ISessionFactory creation method): FluentConfiguration configuration = Fluently.Configure(); ...

How do I setup a Criteria in nHibernate to query against multiple values

I want to query for a set of results based on the contents of a list, I've managed to do this for a single instance of the class Foo, but I'm unsure how I would do this for a IList<Foo>. So for a single instance of the class Foo, this works: public ICriteria CreateCriteria(Foo foo) { return session ...