nhibernate

What would be the equivalent VB.NET code for this C# FluentNHibernate component mapping?

I'm a C# programmer constrained to write VB.NET code. While exploring NHibernate further for my current client, I encountered FluentNHibernate, which I find real attractive. But now, I wonder how to "translate" this C# code for component mapping into VB.NET code: Component(x => x.Address, m => { m.Map(x => x.Number); m.Map(x =...

None in this world worked with Nhibernate and oracle stored procedure before?

Hi all, I am continuously posting the same kind of question but no one answering. This is the happening for the first time. Please help me if any one can. Problem: I have mapped my database table with NHibernate to C# class. But i need to call a stored procedure with some parameters. But NHibernate calls the stored procedure with it...

NHibernate With SQL Server Full Text

How-tu use NHibernate (with Fluent NHibernate) with SQL Server Full Text Search ? Thanks ...

NHibernate Validator One Value OR Another

Is it possible with NHibernate validators to get a validator that will validate one or other properties? In the example below either FirstName OR Surname is required. [OneOrOther("Group")] public string FirstName {get; set; } [OneOrOther("Group")] public string Surname {get; set; } ...

NHibernate and overridden properties

First of all let me just say that I am new to nHibernate so if the answer to this is obvious forgive me. I have an abstract base class with all it's members abstract. public abstract class BallBase { public abstract RunsScored { get; } public abstract IsOut { get; } public abstract IsExtra { get; } public abstract GetIncrement...

NHibernate one shot delete

I'm trying to clear a collection in a parent/child relationship by either clearing the collection (list.clear()) or creating a new instance of the collection on the parent. Similar to this: http://markmail.org/message/mnvooa7g57dlbxta#query:+page:1+mid:mnvooa7g57dlbxta+state:results My test is pretty much identical to the one in the l...

Nhibernate: Component with HasMany

I have this mapping: public sealed class EntityMap : ClassMap<Entity> { public EntityMap () { ... Component(entity => entity.StateHistory, m => m.HasMany<HistoryItem<EntityState>> (Reveal.Property<EntityStateHistory>("Items")) .Table("EntityStateHistory") ...

NHibernate 2nd Level Cache and Joined Subclass

I'm having a problem where an entity mapped as a joined subclass is cached on insert, and the cache does not get updated when I perform an update on this entity. Should the NHibernate 2nd level cache be updated when an update is performed on a joined subclass? I'm using the SysCacheProvider, and the class is mapped with a <cache usage...

Querying selected columns with NHIbernate?

Hi All, In my POCO class I have 16 attributes that are mapped to the database table with 16 columns. Now I have to write methods that only fetch a subset of columns from the table using NHIbernate. How to perform this thing when I dont want to fetch all the attributes of the persisted objects in the database. ...

Question on retreival of only subset of data record from a table using NHibernate?

Hi, Suppose there is table (Tbl_Test) with 7 columns A,B,C,D,E,F,G and similarly there is an Entity class with all these as its attributes a,b,c,d,e,f,g. If I query the table using Nhibernate to fetch a record: IQuery query = session.CreateQuery("select I.A, I.B, I.C from Tbl_Test I where I.D :xyz"); "Suppose there is only one re...

Real world experiences with AutoFetch for Hibernate?

I saw the project AutoFetch for Hibernate. It sounds pretty cool - when Hibernate queries are executed, it checks for the N+1 problem. If there was a problem, next time that query (it figures out which one it is by looking at the stacktrace) gets executed it adds appropriate fetch statements. It says on the website "Autofetch integrates...

Wrapping NHibernate mapped object with DTO

NHibernate mapped objects produce lazy-loading for their references to other objects unless it's set SetFetchMode (Eager) or fetch="eager" attribute. The drawback is that whenever our DAO classes produce the nhibernate-mapped objects for other application tiers (Services, Controllers, UI), they in order may access unloaded proxy referenc...

Projections in NHibernate

suppose in an entity there are attributes id, username, age, address. Now I just want id and username and I use this code for it. Projections enable the returning of something other than a list of entities from a query. var proj = Projections.ProjectionList() .Add(Projections.Property("Id"), "Id") .Add(Projections.Property("Use...

Modeling one to zero or one relationships (Z cardinality)

I'm struggling to find the best way to model 1 : 0,1 relationships ("may have one" or "has at most one"). I believe this is called Z cardinality. For example, suppose I have two classes Widget and WidgetTest. Not all Widgets are tested and the test is destructive so there can be at most one WidgetTest per Widget. Also assume that it's i...

NHibernate Criteria against an <ANY> Mapping

I have a Project model that has a property of type IProjectWorker, this could either be a single User or a Team. In Castle ActiveRecord it's defined like this: [Any(typeof(int), MetaType = typeof(string), TypeColumn = "WorkerType", IdColumn = "WorkerID", Cascade = CascadeEnum.None)] [Any.MetaValue("USER", typeof(User))] [Any.MetaValue(...

Map collection of timespan with fluent nhibernate

Hi I have an object that contains a collection of TimeSpan like Note.Reminders, where reminders is List. How to I map this using fluent nhibernate? Currently I have mapped it as m.HasMany(c=>c.Reminders).Access.CamelCaseField() But i complains that it can not find a mapping for type TimeSpan. ...

Hibernate performance issue with OneToMany / nullable relationship

We use @OneToMany for our Parent->Child->Child->Child DB relationship: @OneToMany(cascade = CascadeType.ALL) @JoinColumn(name = "THE_ID", nullable = false ) private List<ChildClass> children = new ArrayList<ChildClass>(); We have a scenario with a lot of data (100K inserts) where the performance is atrocious (actually times out) when ...

Nhibernate Common columns in base class

I want to design following scenario Base class (Id, Name, order, Value) 3 Derived classes derive1, derive2, derive3 inheriting properties from base There is no table for base class. And 1 table for each derived class. 3 tables have same columns. How can I create mapping file ignoring base class? Do I need to create 1 mapping file fo...

NHibernate cascading save

This is trying to insert null into Comment.BlogArticleID. The following GenericADOException appeared: "could not insert: [NHibernate__OneToMany.BO.Comment][SQL: INSERT INTO Comment (Name) VALUES (?); select SCOPE_IDENTITY()]" The following Inner-Exception appeared: "Cannot insert the value NULL into column 'BlogArticleID', table 'Rela...

Nhibernate: distinct results in second level Collection

I have an object model like this: class EntityA { ... IList<EntityB> BList; ... } class EntityB { ... IList<EntityC> CList; } I have to fetch all the colelctions (Blist in EntityA and CList in EntityB), because if they all will be needed to make some operations, if i don't eager...