I have 2 tables in my database:
Category
BlogEntry
Each BlogEntry has 1 or more Categorys associated with it.
If I want to get a BlogEntry by its ID, I also want to get its Category information.
Maybe this example doesn't illustrate exactly a scenario where this would make sense, but say I want to load the Category ID and Name only...
I am interested in learning NHibernate.
So, I found this:
http://www.summerofnhibernate.com/
I would like to watch these, but I am afraid that the videos are for a previous version of NHibernate. Is this true and if so should I still watch them? Is there a current video series?
Any other suggestions for learning NHibernate?
...
I'm profiling out unit & integration tests, and I find the a lot of the time is spent on the finalizer of NHibernate.Transaction.AdoTransaction - this means it is not getting disposed properly.
I am not using AdoTransaction directly in the code, so it's probably used by some other object inside NHibernate. Any idea what I'm forgetting t...
I'm seeing a problem in a unit test where Oracle is thrown an exception with the message "Unable to enlist in a distributed transaction". We're using ODP.net and NHibernate. The issue comes up after making a certain number of commits to the database inside nested transactions. Annoyingly, this is failing on the continuous integration ser...
I have a Group. That group can contain groups and this needs to be mapped with NHibernate. I have done this before but this time I got an existing database that does not really store the data like I would like it too.
The database looks like this:
Groups
Id
Groups_Link
ParentId
ChildId
I have no clue about how to map this?
Edit:
...
Are there any live, web 2.0 type applications that use nHibernate?
Looking for some real world usage on a high traffic web site/service.
...
Trying to wrap my head around nHibernate, curiuos how this scenerio would be handled:
Post (postID, title, content, dateCreated)
Category (categoryID, name, postCount)
post_to_categories (postID, categoryID)
If I create a Post, it should insert into Post, insert into post_to_categories and update the postCount in Category.
I am plan...
Or possibly there is a better way.
I am building a dynamic query builder for NHibernate, we don't want to put HQL directly into the application, we want it as ORM agnostic as possible. It looks like this currently:
public override IEnumerable<T> SelectQuery(Dictionary<string, string> dictionary)
{
string t = Convert.ToSt...
Is there any way to write an integration test to test that the FetchMode.Eager works correctly? I want to verify that it's not going to the database when I retrieve MySubObject.
The code:
public MyObject GetEager(string name)
{
return Session
.CreateCriteria(typeof(MyObject))
.SetFetchMode("MySubObject", FetchMode....
Is it possible to find out the property name of the current column within the IUserType.NullSafeGet function?
The string[] names parameter of the IUserType.NullSafeGet function does only provide the aliases of the field that was used for the query. But in order to get a list of attributes that are attached to the owners (object owner of...
This is a common question, but the explanations found so far and observed behaviour are some way apart.
We have want the following nHbernate strategy in our MVC website:
A SessionScope for the request (to track changes)
A ActiveRecord.TransacitonScope to wrap our inserts only (to enable rollback/commit of batch)
Selects to be outside ...
My scenario is as follows:
I have some objects (Messages) that can be tagged
So I have a Tag entity and many-to-many relationship
The above is done and working
Now, when tagging, I'd like to save new tags only if they don't exist (where existence is checked by tag title)
if the tag already exists, I'd like it to be recognized and attac...
I'm using NHibernate and getting an ProxyFactoryFactoryNotConfiguredException while calling _factory.BuildSessionFactory();. I have lazyness disabled by default and have no property that is mapped as lazy. Is the proxy factory needed anyway?
...
In NHibernate HQL you can select multiple entities for a given query like this example.
var query = session.CreateQuery("select c,k from Cat as c join c.Kittens as k");
Obviously the real world situation has more complexity but that is the basics. Is there a way to do this in a Criteria query?
...
Hi everybody!
I am trying to develop my Hello World program in NHibernate.
My codes are as follows:
MyClass.cs
----------
using System.Collections.Generic;
using System.Text;
using System;
using NHibernate.Collection;
using NHibernate.Mapping;
using Iesi.Collections;
namespace NHibernate__MyClass
{
public class MyClass
{
...
I was reading this blog entry:
http://blogs.hibernatingrhinos.com/nhibernate/archive/0001/01/01/the-repository-pattern.aspx
I like how they made a interface that has all the basic CRUD queries for you, and you can use it accross all your entities/tables.
Can this also be done with linqtosql as well?
Code:
public class Reposit...
http://stackoverflow.com/questions/1020128/getting-started-with-nhibernate
How can I generate identity fields in nHibernate using Hilo algorithm?
...
I have an entity that when it has a property updated, it ends up causing two updates with exactly the same SQL. There are many possible causes of this, but I've verified that there's a problem only if adonet.batch_size is anything greater than 0. If adonet.batch_size = 0, then there's just one update.
Has anybody else ever run into this...
In my application I want to cache data loaded with NHibernate. I don't want to use the second level cache of NHibernate as this cache is not really meant to cache an entire graph of objects. But what is the best strategy to make sure I don' have any lazy loading proxies and/or collections in my graph?
...
given the following class definition:
public class Order {
public IProduct Product {get;set;}
}
I have this (fluent) mapping
References(x=>x.Product, "ProductId");
And get this exception: An association from the table Orders refers to an unmapped class, which makes sense because it doesn't know what implementation I will pass to ...