nhibernate

"No persister for" error with NHibernate, NHibernate.Linq and Fluent Mapping

Hi, I´m using Nhibernate 2.1.2.4000 GA with Nhibernate.Linq 1.0 and latest version of FluentNhibernate downloaded from master on github. Im doing some tests and whenever I try to delete a entity retrieved by a linq query i´m getting this error: No persister for: NHibernate.Linq.Query`1[[Employees.Core.Entities.Employee, Employees.Core...

Nhibernate ICriteria - Check property value length

Hello, I'm trying to return all entities where a given property is not empty. The problem is IsNotEmpty() only applies to collections. Below is the general approach I've taken so far, it obviously doesn't work. ICriteria lvCriteria = NHibernateHelper.GetCurrentSession() .CreateCriteria(typeof(Funct...

Transactions in Castle ActiveRecord + NHibernate for dummies

I would like to do the following, all in a single atomic transaction: Read an object through ActiveRecord Save a new object through ActiveRecord Update another table via NHibernate Also, if by the time I finish the transaction, the value of the object I've read in step 1 has changed, I would like the transaction to fail. I've never ...

nhibernate, difference between .Get<T> and .Load<T>

whats the difference in the method .Get(object id) and .Load(object id) ? The documentation pretty much reads the same. Also, if it matters, in what cases should I use one over the other? ...

IQueryable contains any of string array

I am not shore why IQuerable limits me when I try to search database for data containing string from an array. objectFactory.Resolve<IUserDao>().Query. Where(t => (spltedInput.Any(val=> t.LastName.Contains(val)) || spltedInput.Any(val=> t.Name.Contains(val))) && t.MasterCompany.I...

nhibernate mapping: A collection with cascade="all-delete-orphan" was no longer referenced

Hi All I am having some probs with my fluent mappings. I have an entity with a child collection of entities i.e Event and EventItems for example. If I set my cascade mapping of the collection to AllDeleteOrphan I get the following error when saving a new entity to the DB: NHibernate.HibernateException : A collection with cascade="all-...

Implementing SaveAs with NHibernate

In a project I am working on we are developing Save-As functionality for a windows desktop application. This should allow the user to save his work (in a project) to a different location (just SaveAs ;). Our project file contains a sqlite db with our domain objects and the persistency is done using NHibernate. Now our SaveAs logic look...

Fluent Nhibernate Oracle Identifier Too Long - Alias Name Issue

I've tried to do that. HasManyToMany<YechidotDoarInGroup>(x => x.Col_yig) .Table("PigToYig") .ChildKeyColumn("YIG_GROUP_RECID") .ParentKeyColumn("PIG_GROUP_RECID"); but I've got ORA-00942: table or view does not exist I am trying to establish HasManyToMany conn...

How can I get SQL Sever Tables to appear in Reverse Engineering Wizard?

Hello.. I don't do much Java coding so I am not too familiar with the NetBeans IDE. I am trying to create a reverse engineering file based on a SQL Server connection that is set up in my hibernate.cfg.xml. The reverse engineering wizard does not show any tables given the configuration file. I do not receive any error however. I believ...

How to dispose NHibernate ISession in an ASP.NET MVC App

I have NHibernate hooked up in my asp.net mvc app. Everything works fine, if I DON'T dispose the ISession. I have read however that you should dispose, but when I do, I get random "Session is closed" exceptions. I am injecting the ISession into my other objects with Windsor. Here is my current NHModule: public class NHibernateHttpMod...

NHibernate: How to exclude a class which is part of a join using the Criteria API

I am still new to Hibernate and am attempting to use it for a web site I have inherited. Unfortunately that means sometimes the db schemas don't always make sense. With that said, I am trying to build the following HQL query using the Criteria API from TableB b where b.id = :id and b.TableAProperty.UserId = :userId The above HQL sta...

Get tags like Stackoverflow with NHibernate

My model is like this: Flavor public IList<Mention> Mentions Mention public IList<Flavor> Flavors Therefore, a many-to-many between Flavor and Mention. I need to create a query that returns me the flavors mentioned and the amount of times it was mentioned. Today, I can get the query terms ordered by the number of flavors mentio...

Consolidating NHibernate open sessions to the DB (coupling NHibernate and DB sessions)

Hi. We use NHibernate for ORM, and at the initialization phase of our program we need to load many instances of some class T from the DB. In our application, the following code, which extracts all these instances, takes forever: public IList<T> GetAllWithoutTransaction() { using (ISession session = GetSession()) { ILis...

Is update with nested select atomic operation?

I need to select first (let's say) 10000 rows in database and return them. There may be more clients that do this operation at one time. I came up with this query: update v set v.batch_Id = :batchId from tblRedir v inner join ( select top 10000 id from tblRedir where batch_Id is null ...

Nhibernate does not work after upgrade to version 2.1.2

I recently changes my NHibernate implementation from Version 2.1.0 to 2.1.2. For lazy loading I used the LinFu implementation using : NHibernate.ByteCode.Linfu. Since I changed to the newest version I got the following error: [SecurityException: That assembly does not allow partially trusted callers.] NHibernate.ByteCode.LinFu.Proxy...

NHibernate - Anyone have success upgrading to IBM Client Access v5.9 and IBM.Data.DB2.iSeries v12?

I recently upgraded my client access v5.4 to the latest v5.9. However, now, when I make a call to flush() from NHibernate's session object, the output shows the proper update query but it blows up on me. After the call to flush--even though I'm in Visual Studio--the operating system asks me which debugger I would like to use. I've select...

How to configure Fluent NHibernate to output queries to Trace or Debug instead of Console?

How to configure Fluent NHibernate to output queries to Trace or Debug instead of Console? I'm using MsSqlConfiguration.MsSql2008.ShowSql() but it has no parameters and I can't find anything on Google. ...

NHibernate unidirectional one-to-one mapping problem.

I am trying to create a Unidirectional one-to-one relationship using NHibernate. Example: An Order is given by a Customer. Customer{ID, Name, Address} OrderN{ID, Customer, OrderDate} Here, OrderN.Customer-field is intended to store Customer.ID as an FK. And this field doesn't have any unique constraint. (The OrderN-table is given su...

NHibnerate data design recommendations

While doing some research into mapping one-to-one relationships I've come across some statements that have made me question some of my database design decisions. Basically I have some entities similar to the following: Person, Contact, Parent Both a contact and a parent are people. A person may be a contact, parent, both, or neither. ...

NHibernate insert unmapped column in interceptor

I'm trying to use nhibernate with a legacy database that has 'evolved' over the past decade or so. As you can imagine, it has a lot of crud in it, specifically, some obsolete columns. To make things worse, a lot of these obsolete columns have 'NOT-NULL' constraints, so I can't just ignore them when trying to insert records into these res...