nhibernate

Not-found="ignore" behaviour in Castle Activerecord

Is it possible to implement the 'not-found="ignore"' behaviour of NHibernate on a key mapping when using Castle Activerecord? I am using existing legacy Castle Activerecord classes within an ASP.Net web application to map to a legacy, read only, MSSQL database. I cannot alter the database in any way. The parent Product table has a rela...

Fluent Nhibernate - Generate a non-primary-key sequence generated value

I have an entity mapping quite similar to this one. public class MyClassMap : ClassMap<MyClass> { public MyClassMap() { Id(x => x.Id); Map(x => x.Code); Map(x => x.Name); Map(x => x.Description); } } I'd like to know if there's any possible way to have the Code field (which is not part of t...

Implementing new NHibernate type for POINT postgresql data type (or any COLUMN of a non-primitive analogous nhibernate type)

Hi everyone. I have a problem with NHibernate and the postgresql POINT data type (although I believe this is a common problem for all of those trying to map a SQL TYPE that is not covered by NHibernate SqlTypes). My Data.Point class has two public floats: xcoordinate and ycoordinate. My first attempt was trying to implement the IUserTy...

NHibernate : Transactions are not closing

Hi, We have created one application using Silverlight and NHibernate. and SOA architecture is used. When i run the application, it creates NHibernate sessions, which i can see in the sqlserver Activity Monitor. But after completion of the transaction still that session is not going to be closed [i can see session in sleep mode]. it clo...

Could not load entity error

Hi, i`m having the error message could not load an entity: [API.Issue#8087][SQL: SELECT issue0_.ID as ID1_14_, issue0_.ProjectID as ProjectID1_14_, issue0_.Summary as Summary1_14_, issue0_.Description as Descript4_1_14_, issue0_.CategoryID as CategoryID1_14_, issue0_.PriorityID as PriorityID1_14_, issue0_.CreationDate as Creation7_1...

Fluent NHibernate Mapping - State Pattern

Hi, I'm not too hot on NHibernate / FNH Mapping but I am looking at implementing the state pattern and like the idea of Derick Bailey's article here: I beleive this was a while ago so the mapping code is out of date, can someone give me a hand to update it for FNH 1.1? public class OrderStatusMap: ClassMap<OrderStatus> { public Ord...

exception saving a deep cloned C# nhibernate object

Hi, I'm having a hard time trying to clone a complex C# object persisted with NHibernate. The object has a deeply nested structure with lots of children objects organized in ILists, but it is completely self contained, without references to other persisted entities. What I've tried to do so far is to deep clone the object through seriali...

Rewriting NHibernate app in Linq to SQL

Hi, I have an old outdated application written using NHibernate. Now I would like to rewrite it including new functionality and big changes in model. What are main dissadvantages of using Linq to SQL instead of NHibernate ? What are possible problems of using LINQ to SQL, does making DataContext as somethink like singleton can give p...

Switching from Oracle 10g Express to SQL Server Compact (NHibernate)

Hey, I am switching my application from Oracle 10g to SQL Server Compact. Currently I have this in the mapping file: <id name="Id" column="MY_ID"> <generator class="sequence"> <param name="sequence">MY_SEQ</param> </generator> </id> and I have been informed that sequence does not exist in SQL Server Compact, I was wondering i...

Designing layered app with NHibernate and context changing database

Hi eveybody, I'm designing a C# application Presentation ( web site + flex apps ) Business Logical Layer (might be WCF to enable multi client platforms) Data Access Layer ( With NHibernate ) We're going to integrate our solution in many preexistant client's database environnements and we would like to use NHibernate in the DAL.. My...

Nhibernate class mappings

Question: I have the below nHibernate mapping via attributes. Now I want to create T_lsDomains with a dynamic table prefix. Such as TBL_lsDomains or just lsDomains. Is there any way I can do this with attributes? Since they are defined at compile time, and must be constant? Is there any way to do this? Or can fluentNhibernate do thi...

convert HQL query to criteria api

I'm wondering if is possible to convert this HQL query into a criteria api query. select s1 from Student where ( select max(s2.Score) from Student where s1.Id = s2.Id ) = 10 (selects the students that have their max score value equal to 10) I don't know if I could use a detached criteria beca...

Using nhibernate to filter by the value of an object in a child collection.

Here's the setup. NHibernate, Fluent NHibenrate and Nhibernate Linq The entities invoved are Fault - a record of a fault occuring Alarm - information about the fault, think of it as a fault type ( a list of all possible faults that can occur ) AlarmDescription - human readable description, one for each language A fault has an alar...

Timeout exception when timeout set to infinite time

In my C# .NET 3.5 application I am using CastleProject ActiveRecord over NHibernate. This is desktop application using MS SQL Server 2008. I have set ADO command timeout to 0 to prevent timeout exception during bulk operations: <activerecord> <config> ... <add key="hibernate.command_timeout" value="0" /> </config> ...

Nhibernate Architecture - Generic Nhibernate Repository to serve many different types

Hey all.. I am looking to get some feedback on how I can improve my design. Specifically, I don't want to have to create a new repository object for each of my domain objects but I also do not want to rewrite the Session and Transaction logic over and over. To alleviate the need to write the code to obtain a new session and transation ...

Is SessionScope exact equivalent of ISession?

Is Castle ActiveRecord's SessionScope exact equivalent of NHibernate's ISession? If yes, why Castle ActiveRecord has provided a duplicate feature? If no, what are their differences? ...

NHibernate - Many To One - NHibernate.LazyInitializationException - Could not initialize proxy

I am getting this exception when I attempt to access an object that is stored in a property of my domain object. I have done some research and still do not understand why I am getting this error. I have a very basic repository in which I am creating a session and then using a ICriteria query to fetch the first record from the list of r...

Within ActiveRecordMediator, should use Execute or CreateSession?

Suppose I'm going to do something that needs access to NHibernate's ISession. For example running a Sql query via ISQLQuery or running a LINQ-to-NHibernate via session.Linq<MyType>(). I know there is 2 way to access ISession: ActiveRecordMediator.GetSessionFactoryHolder().CreateSession() ActiveRecordMediator.Execute() What is the p...

persiste the deletion operation from a collection in NHibernate

When i delete some object (or remove it) from a collection (such as list) and call SaveOrUpdate from the parent of this collection the row of the child isn't removed but updated by setting the foreign key value to NULL. How can i force it to be deleted (the child row). ...

NHibenrate second level cache unexpected behaviour

I'm using NHibernate with ASP.NET and I initialized a session factory at Application_Start that is used to produce sessions for requests. I configured NHibernate to use second level cahe and I use an entity called Post configured to be cached. I have two scenarios: The first scenario var session1 = sessionFactory.OpenSession(); var ...