On properties inside my domain objects which I do not want lazy loading, I omit the virtual modifier, and also update the mapping file to reflect this using for example:
<property name="UserName" column="Name" type="String" length="40" lazy="false"/>
I would have though that setting the property lazy to false would make it accept that...
I'm using nhibernate to load parent class in a not lazy way
and I have many-to-many set of child class that I want to determine in run time rather to load it lazy or not.
I'm using .hbm.xml mapping and I tried to change the set "lazy" property after loading the assemblies, is it possible?
...
Components which have no value assigned to any child property will also be set to null when being retrieved from the database.
I don't mind this, it's simply an additional check to see if the component is null or not. However when I try to then update or insert that object into the database with the null component I get the error:
"no...
I've started getting to grips with NHibernate. I'm trying to perform a query that selects all records from a table but with an exclusion filter list of IDs, eg. get me all Products except these ones with these ID values.
Normally in direct T-SQL I'd pass in the IDs to be excluded into a NOT IN clause like so.
SELECT *
FROM Products
WHE...
I am looking for any kind of documentation, an open source nhibernate winform application that i can study, or even better a winform / nhibernate framework.
I saw a little bit of it in Nhibernate contrib and NhAddins but that s all.
There is plenty about web but very few about winform.
Why is that ?
...
Hi!
I'm looking for an NHibernate criterion which does not add a restriction to a criteria. The reason for this is that I have a method which converts some input parameters into a criterion which is added to a criteria. There is a constellation of the input parameters where no restriction needs to by applied. Therefore I want to return ...
Hi,
I have this project where I would like to go from regular ADO.NET code to a more productive, more understandable, leaner and meaner OR/M system. I have the following scenario that currently works but has to work with the OR/M as well:
Orders:
id
stuff
Documents:
id
order_id
path
When I create a new order I attach a document...
Hi,
I'm trying to extend my webapp with IronPython, which is working wonderfully so far, but I can't seem to get it to play nicely with my NHibernateLinq setup.
I'm making an IQueryable<Case> available to the IronPython code, and then I'm using the Linq methods to filter it down, such as:
Enumerable.Where[object](data, Func[object, bo...
I need to reference a column called limit in a legacy oracle database and also use a SQLite in-memory database for unit testing.
I have read to use backticks in the mapping files to accomplish this; limit which works fine in SQLite, but resolves to "limit" in oracle and barfs on the query.
Is this feature implemented correctly for oracl...
Using NHibernate, how can I map the following scenario:
public class User
{
public virtual IDictionary<Project, IList<Role>> ProjectAssignments { get; set; }
}
In the database I have separate tables for User, Project and Role and a fourth table for the relationship.
Any help would be appreciated.
...
I am working on a project that requires the use of multiple databases that for the most part are completely identical but some columns might be missing. How do you get NHibernate to handle this for instance i have a table with 4 columns an index and 2 data coloumns that will always be availible but a singe customer does not want the colu...
Any suggestion how to fix this error? (I'd rather not create an sql view to skirt the issue with the sum aggregate)
"Can't extract the type of one parameter of a HQL function: expression->{TreatmentTime}; check aliases. [select new TherapyMinutesDisciplineByDayDTO( sum(TreatmentTime), 2.0, 3.0, t.TreatmentDate, p.LastName, d.Description...
Hi,
I want to create my database layer so I can swap it out and use say LINQ or whatever in the future.
In my abstract class (or interface), what return type should I use for results that return a list/collection of items?
Does nHibernate return List?
...
I have two classes:
public class Code
{
public virtual Guid CodeId { get; set; }
public virtual string CodeValue { get; set; }
public virtual Guid EntryId { get; set; }
}
public class Entry
{
public virtual Guid EntryId { get; set; }
public virtual string FirstName { get; set; }
public virtual string LastName { ...
In a SQL server db I have a Name column in the Departments table, with nvchar(25) not null, unique. I test to see what happens if I try and save a Department with a Name that is bigger than that and get an "NHibernate.Exceptions.GenericADOException" making it clear that ""String or binary data would be truncated". So far, so good.
In an...
Is it advisable to use self-referencing generic inheritance?
public abstract class Entity<T> {
public Guid Id {get; set;}
public int Version {get; set;}
public T Clone() {
...
// clone routine
...
return T;
}
}
public class Customer : Entity<Customer> {
public string CustomerName {ge...
I've read somewhere that NHibernate 2.1 supports constructor dependency injection for it's entites.
How do I go about configuring StructureMap and NHibnerate 2.1 to get this up and running ?
...
I am using ASP.NET-MVC and nHibernate for the first time. Great tools, but big learning curve!
I have a list view of objects that are quite large (each has about 60 properties). In the list view I am only using about 10 of these properties. Performance is not too bad, but it seems a waste to fully hydrate these objects. What is the reco...
In HQL, how can I use bitwise operators? I want the resulting SQL query to look something like
SELECT RoleId, RoleName, RolePerms WHERE (RolePerms & @Parameter) = @Parameter
However, writing this HQL
select from Role where (RolePerms & :param) = :param
gives me this error: NHibernate.Hql.Ast.ANTLR.QuerySyntaxException: Exception of...
Can anyone tell me if it's possible to add criteria to an NHibernate lazy loaded collection.
For example let's say I have a department that contains employees... I get the department by id and then I lazy load the employees... however lets say there are 1000's of employees and I only want the employees that were hired in the last 30 d...