nhibernate

NHibernate Many-To-Many Is Deleting All Associations Before Inserting

I have a Users table and a Networks table with a many-to-many relationship between them (a user may be long to multiple networks and a network may contain many users). The many-to-many relationship is held in a "UserNetworks" table that simply has two columns, UserId and NetworkId. My classes look like this: public class User { pu...

SchemaUpdate does not drop tables or delete columns

I am using SchemaUpdate to make changes to the database based on some configuration. It works fine when new tables or columns are added. However, it does not work when columns are deleted or tables are dropped. The mapping file does reflect these changes, but the SchemaUpdate does not seem to recognize this. I don't want to drop the tabl...

NHibernate + Jet Replica Database - Exception thrown when committing transaction ("a different object with the same identifier value was already associated with the session).

I have an application where we're using NHibernate and the NHibernate Jet Driver to open existing .MDB files (Access 2003 / Jet 4.0 databases), read some information and add some new records. Unfortunately we have no control over the database format - so we're stuck having to support Jet. The problem I'm facing is that when performing ...

Converting this method from IList to IQueryable

Is it possible to convert: public IList Get() { return Session.CreateCriteria(typeof(T)).List(); } to return IQueryable? What is the difference between IList and IQueryable? ...

nhibernate Operation could destabilize the runtime.

Locally my site works, but at host I am getting the error: "Operation could destabilize the runtime." I am using nhibernate. I am using the repository pattern. [VerificationException: Operation could destabilize the runtime.] CategoryProxy..ctor() +6 [TargetInvocationException: Exception has been thrown by the target of an invocat...

IIS7 + NHibernate: Illegal operation attempted on a registry key that has been marked for deletion

We have an asp.net MVC app using Fluent Nhibernate running on top of IIS7 & Windows Sever 2008. Frequently (although so far we have yet to consistently reproduce it) after a build we get a yellow screen of death with this exception: [COMException (0x800703fa): Illegal operation attempted on a registry key that has been marked for delet...

NHibernate - how to get an item that is not referenced by an item in another table

Let's say I have a class Voucher: public class Voucher { public Guid Id {get;set;} public DateTime DateAvailable {get;set;} } and a class Entry public class Entry { public Guid Id {get;set;} public Voucher Voucher {get;set;} // ... other unrelated properties } How can I create an NHibernate Criteria query that f...

nhibernate query to return a User by his Guid

I have a user class: public class User { public virtual int ID {get;set;} public virtual string UserGuid {get;set;} // its unique! } Can someone show me how to query using HQL and criteria to get the user by UserGuid? ...

Is having an entity named Order an issue with nhibernate?

Is having an entity named Order an issue with nhibernate? Update I ask because, it does! I just ran sql profile, and when I run the code that they generate I get an error saying: Msg 156, Level 15, State 1, Line 10 Incorrect syntax near the keyword 'Order'. (or I have some issue with my mapping??) ...

How does LLBLGen Pro Stack up Against Nhibernate Performance Wise

I have search the internet high and low looking for any performance information for LLBLGen Pro. None found. Just wanted to know how does LLBLGen Pro perform compared the Nhibernate. Thanks ...

Is NHibernate.Linq 1.0 GA Provider Production Ready

Is NHibernate.Linq 1.0 GA Provider Production Ready ? ...

nhibernate: how to map two tables to a single non-persistent class?

I have two similar tables: Table1: [ id ] | [ name ] Table2: [ id ] | [ name ] and I need to read/write data using only one class: public class TwinTable { public virtual int Id { get; set; } public virtual string Name1 { get; set; } public virtual string Name2 { get; set; } } Plus one of the tables may or may not have...

nhibernate - cyclic reference not updating

I have two objects that reference each other. From a purely schema perspective, object one could have many instances of object two that reference it, but the business logic specifies that each instance of object 2 will reference a unique instance of object one and vice versa. Example: public class Object1 { public Guid Id {get;set;...

Custom SQL function for NHibernate dialect

I want to be able to call a custom function called "recent_date" as part of my HQL. Like this: [Date] >= recent_date() I created a new dialect, inheriting from MsSql2000Dialect and specified the dialect for my configuration. public class NordicMsSql2000Dialect : MsSql2000Dialect { public NordicMsSql2000Dialect() { Register...

Nhibernate 2.1.0.4000 slower than 2.0.1.4000? Any NH default setting changed?

I just switched to Nhibernate2.1.0.4000 with Nfluent 1.0RTM and Linq To Nhibernate 1.0.0. Suddenly I found that now a simple session.Save takes a minute compared to before not more than 10 secs. As I switch back times are back to normal... I dumbfounded. Has anyone made the same experience? What could cause the drag ? some changed defaul...

advice on my DAL layer, any obvious issues with it?

I am using nHibernate. My classes are POCO, that map 1:1 with my database tables. I created a IGenericDAO -> GenericDAO that does all my basic CRUD. (repository) Each table has a DAO class, so: public class UserDAO : GenericDAO Any table specific queries will go in the tableDAO class. I then have a factory, IDAOFactory. public class ...

Cannot use Guid Identity in fluentnhibernate

I have the following mapping: public class MyClassMap : ClassMap<MyClass> { public MyClasseMap() { Table("TABLE_NAME"); Id(x => x.Id).Column("TR_ID"); } } When I try to retrieve all the entities using criteria objects I get the following: System.FormatException : Guid should contain 32 digits with 4 dashes...

NHibernate: Select MAX value concurrently

Suppose I need to select max value as order number. Thus I'll select MAX(number), assign number to order, and save changes to database. However, how do I prevent others from messing with the number? Will transactions do? Something like: ordersRepository.StartTransaction(); order.Number = ordersRepository.GetMaxNumber() + 1; ...

Allowing partially trusted callers security exception is been thrown althought running on Full trust mode

Hey, While developing using ASP.net 2.0 (C#) and NHibernate 2.1.0 I am getting the error: System.TypeInitializationException: The type initializer for 'NHibernate.ByteCode.LinFu.ProxyFactory' threw an exception. ---> System.Security.SecurityException: That assembly does not allow partially trusted callers. This error is been thrown o...

NHibernate: Is it possible to add restriction based on alias name

Say I create a criteria query and transform it with the AliasToBean result transormer. session.CreateCriteria<Staff>("s") .CreateAlias("supervisor", "super") .SetProjection(Projections.ProjectionList() .Add(Projections.Property("s.name"), "name") .Add(Projections.Property("super.name"), "supervisor_name")) .SetResultTrans...