nhibernate

NHibernate Criteria using Projections for Substring with in clause

I had a scenario in Oracle where i neeed to match a substring part of column with a list of values. i was using sqlfunction projection for applying the substring on the required column , and addeed that projection as part of an In Clause Restriction. Below is the simplified criteria i wrote for that. ICriteria criteriaQuery = session.C...

Sample Application(s) using Castle ActiveRecord?

I have been trying to track down some sample applications that are using Castle ActiveRecord. Do you know of any good sample applications? ...

How can I diagnose/fix this NHibernate.PropertyAccessException?

Given the following Fluent NHibernate maps: public class FastTrackPackageClassMap : ClassMap<FastTrackPackage> { public FastTrackPackageClassMap() { Id(x => x.Id); References(x => x.UserCreated, "UserIdCreated").Cascade.None(); References(x => x.UserSent, "UserIdSent").Nullable().Cascade.None(); H...

nHibernate one-to-many inserts but doesnt update

Instead of getting into code, I have a simple question. Default behavior for a simple one-to-many is that it inserts the child record then updates the foreign key column with the parent key. Has anyone ever had a one-to-many where the child object gets inserted but not updated resulting in a row in my table with a null in the foreign k...

nhibernate problem on identity column

error: could not insert: [NHibernateExperiment.Domain.Customer][SQL: INSERT INTO Customer (FirstName, LastName, Address) VALUES (?, ?, ?); select SCOPE_IDENTITY()] Mapping: <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="NHibernateExperiment.Domain" ...

Should i use nhibernate for a fairly small project?

Let me say i know NOTHING about nhibernate except its for databases. I am doing a fairly small project, should i learn nhibernate? I guess i have 4 questions Is using a nhibernate overkill in a small project? What should i NOT use nhibernate for? if i have a large project should i use nhibernate if it has very complex tables? What abou...

How to get dummy column in hq uery in nhibernate?

Hi, How can i add a dummy column in HQL query. SQL : select Actualcolumn, 1 from Table In NHibernate How can I do that, I googled for this but I didn't find any solution. HQL: ? Thanks nRk ...

Which is the best for a 3-tier architecture; Linq to SQL or Nhibernate?

Which is the best solution for 3-tier arch. Linq to SQL or Nhibernate? Specifically, I will upgrade a system in 2-tier architecture to 3-tier architecture? Edit: And where can I find good tutorials or videos for both? ...

NHibernate: set entity from transient object based on unique field

My application obtains transient objects. MyClass Id Name OtherData Mapping is like Id is identifier and Name has unique constraint in database. The transient object has no Id yet of course, but has fulfilled Name property and all other properties. So I can write a criteria to get the entity from database based on that unique fi...

What is the equivalent of timestamp/rowversion (SQL Server) with PostgreSQL

Could someone help me find the equivalent of Timestamp/Rowversion (SQL Server) with PostgreSQL? I'm using NHibernate on Mono (UNIX). I think that Timestamp (PostgreSQL) is the equivalent of Datetime (SQL Server) - it's not what I'm looking for. Edit 1: For those who don't know what is a Timestamp/Rowversion in SQL Server: http://msdn...

Fluent NHibernate, varbinary(max) and SQLite

Hi, I have a varbinary field in my sql server database that needs to be varbinary(max). I create my database with NHibernate and I use Fluent Nhibernate for my mappings. I also use SQLite for my unit tests, I use the same mappings I just change the configuration before creating the database in memory. I get the following problem. I c...

nhibernate 2 linq eager load

I'm starting out with nHibernate and have a simple example that I cannot get working as I'd like. I have two model objects (Blog and Posts) and I would like to load them all in a single query for one scenario. I want lazy loading in other cases. I naively thought that I could write something like this: var blogs = session.Linq<Blog>(...

Which is beneficial for start up; Linq to SQL or Nhibernate?

I want to learn ORM and I wonder which is beneficial for start up; Linq to SQL or Nhibernate. considering time,adaptation... etc ...

NHibernate "Errors in named queries"

I have the following named SQL query defined: <sql-query name="ItemSearch"> <return class="ItemSearchResult"> <return-property name="Item" column="ItemId" /> <return-property name="Distance" column="Distance" /> </return> SELECT Items.*, dbo.DistanceBetween(Latitude, Longitude, :lat, :long) AS...

Could you do a query with subqueries like this with nhibernate?

If you had a query that looks like this, could it be converted into a nhibernate query? SELECT .... FROM ( SELECT ... FROM ... GROUP BY... ORDER BY ... UNION SELECT .. FROM ... ) AS ASDF GROUP BY ... ORDER BY ... ...

What is a good Spring.net/NHibernate tutorial?

I am getting ready to start a project which will be using both Spring.net and NHibernate. I have seen a few good tutorials for NHibernate but have had a hard time finding resources for Spring.net. Specifically, I am looking for something that goes the setting up a solution and getting things running. Are there any good tutorials for a...

Sorting on child object in NHibernate

Hello, I have a method that is loading a collection of Products. Each order has a child object called Manufacturer (I have a many-to-one relationship set up in my mapping file). I would like to sort the collection of Products by Products.Manufacturer.Name. How can I do this? Product mapping: <?xml version="1.0" encoding="utf-8" ?> <...

Selecting count of child object collection in NHibernate

Hello, I have a Customer object that has a child Orders collection. I have this relationship set up in the mapping file with Orders being lazy-loaded. Is it possible to lazy-load only the count of Orders instead of the entire collection? If so, how? Thanks! ...

Filtering on a field that is not included in the mapping in NHibernate

Hello, I have an Order object that has a Customer child object. Before I did not have a many-to-one relationship set up and I was simply returning the CustomerID. With that approach I could easily filter by CustomerID. Now I set up a many-to-one relationship and I am unsure of how to filter by CustomerID when I load a collection of Or...

NHibernate Session Management in Console App

I have core library of code which has multiple front ends. One front end is a WCF service, another is a console app that just launches some long running commands which perform financial calcs and other business logic. I am trying to figure out how to manage my ISession in the console app. I 'could' just have one session per "command", bu...