I've got some binary data that I store and was going to separate this out into a separate table so it could be lazy loaded.
However, i then came across this post by Ayende (http://ayende.com/Blog/archive/2010/01/27/nhibernate-new-feature-lazy-properties.aspx) which suggests that property lazy loading is now possible.
I have added the l...
I'm currently working on creating a custom connection provider for HNibernate very similar to the one mentioned here. In it, they specify a separate connection string within the hibernate.cfg.xml parameters. However, when I go to add this new parameter, like so...
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns=...
I'm on SQL Server 2008, using NHibernate as persistence layer (although this problem is purely SQL, I believe).
I've boiled down my problem to the following SQL statement:
SELECT TOP 2
this_.Id as Id36_0_,
this_.Name as Name36_0_,
ROW_NUMBER() OVER (ORDER BY this_.IsActive) as MyOrder
FROM Campsites this_
ORDER BY this...
I am trying to implement an observer pattern using ninject and NHibernate.
I'd like to be able to inject observers that act as "triggers" when an object is persisted or deleted via NHibernate.
Key points-
I want the observer to be notified any time an object is persisted, including cascaded saves, which is why I am using NHibernate P...
Entities:
public class Parent
{
virtual public long Id { get; set; }
virtual public string Description { get; set; }
virtual public ICollection<Child> Children { get; set; }
}
public class Child
{
virtual public long Id { get; set; }
virtual public string Description { get; set; }
virtual public Parent Parent ...
I introduced a mapping for a business object which has (among others) a property called "Name":
public class Foo : BusinessObjectBase
{
...
public virtual string Name { get; set; }
}
For some reason, when I fetch "Foo" objects, NHibernate seems to apply lazy property loading (for simple properties, not associations):
The foll...
I have a legacy data base and a relation one-to-one between two tables. The thing is that relation uses two columns, not one. Is there some way to say in nhibernate that when getting a referenced entity it used two columns in join statement, not one?
I have a similar table structure
TaskProgress
ProgressId
TaskId
AssignmentId
UserId
...
I have a project with a lot of classes that use Nhibernate. Now I want to use NUnit to test those classes. Are there specific things I need to consider?
...
I'm going to start writing NUnit tests for a few classes in my project. A certain number of these classes use data gathered through nhibernate from a sql server 2008 database.
The part of the program I'm about to test is very specific (and complicated). Therefore I have made a folder of xml files. Combined, the xml files could result in...
We're using NHibernate.Mapping.Attributes to do our mappings.
In order to get NHibernate to populate a data object automatically, it appears that you need to allow for an identity column. Okay, no problem, I added a (fake) PK column to my stored procedure results (it's a report query, so the identifier doesn't need to mean anything as l...
Hi,
I'm just starting out with NHibernate and I'm having trouble with running more complex queries.
I have entities with a list of tags attached. The user will provide two lists of tags, include and exclude.
I need to find all the entities that have all of the include tags, and exclude any entites that have any tag in the exclude lis...
Is there a way that the default NHibernate.Caches.SysCache.SysCacheProvider expiry time of 5 minutes can be configured without the use of cache regions? Is there a hibernate property that can be set from config?
...
I am getting the following exception.
NHibernate.PropertyValueException : not-null property references a null or transient
Here are my mapping files.
Product
<class name="Product" table="Products">
<id name="Id" type="Int32" column="Id" unsaved-value="0">
<generator class="identity"/>
</id>
<set name="PriceBrea...
Reverse engineering an existing database to map with N-Hibernate using Fluent N-Hibernate.
How can I map this?
Address table
Id
Address1
Address2
Person table
Id
First
Last
Types
Id
TypeName
PersonAddress table (A person can have home, business etc addresses)
Id
PersonId (Id from person table)
AddressId (Id from addre...
Hello All, I am quite blocked about an exception.
I am using Active Record and Monorail. I was able to use the scaffold controllers in monorail, until I add new models.
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2[System.String,NHibernate.Ma...
It seems that NHibernate needs to have an id tag specified as part of the mapping. This presents a problem for views as most of the time (in my experience) a view will not have an Id. I have mapped views before in nhibernate, but they way I did it seemed to be be messy to me.
Here is a contrived example of how I am doing it currentl...
We would like to map a single table on two classes with NHibernate. The mapping has to be dynamically depending on the value of a column.
Here's a simple example to make it a bit clearer:
We have a table called Person with the columns id, Name and Sex.
The data from this table should be mapped either on the class Male or on the cla...
I have an Nhibernate hbm that maps a many to many relationship. For database simplicity it uses a where clause on the bag to filter the joining table.
this works well until I start to test and I use the hbm file to create a database from the generated schema. The root and user tags columns aren't created.
In the hbm file how do I def...
How do I use the schema clause on a bag object in Nhibernate mapping? I have an table that I need to sepcify the schema for and the nhibernate documentation talks about table schema but I can't find any further details...
...
I've mapped child collections with cascade="all-delete-orphan" and tried
var parent = session.Load<Parent>(id);
session.Delete(parent);
But it also loads parent and all its children before deleting them.
Is there a way to delete parent and children without loading them or at least only load parent?
...