Hi,
I'm trying to setup a sample project using NHibernate and Fluent NHibernate.
I am using the example mappings from the Fluent NHibernate web-site.
My question is about the many-to-many mapping between Store and Product. It seems (when looking at the generated SQL) that when adding a product to the store, NHibernate deletes all the r...
NHibernate and LINQ both or for Object-Relational mapping,apart from different vendor API,
what is the difference between nHibernate and LINQ ?
...
I use jqGrid to display data which is retrieved using NHibernate. jqGrid does paging for me, I just tell NHibernate to get "count" rows starting from "n".
Also, I would like to highlight specific record. For example, in list of employees I'd like a specific employee (id) to be shown and pre-selected in table.
The problem is that this e...
I'd like one of my entities to have a one-to-one relationship with a class hierarchy. Think of it like a Strategy pattern, where each strategy needs different parameters to be persisted. I tried using a combination of OneToOne and JoinedBase/JoinedKey, but I've come across a problem.
With this combination, the primary key of the main en...
Hi,
I have two following classes:
public class User
{
public virtual Guid Id { get; set; }
public virtual UserCredentials Credentials { get; set; }
// other stuff
protected User() { }
}
public class UserCredentials
{
public virtual Guid Id { get; set; }
public virtual string UserName { get; set; }
// oth...
OK, this is going to be kind of a long shot, since it's a big system (which I don't claim to fully understand, yet), and the problem might not be with NHibernate itself, and I'm even having trouble reproducing it, but...
I've got a class with a <dynamic-component> section, and when I run a query on it (through my ASP.NET MVC app), it fa...
One of my applications is a public website, the other is an intranet. The public website runs using a limited security user that must access a certain table through a view, whereas the intranet can access the table itself.
This seems like it would be quite simple to setup using Fluent NHibernate. In my ClassMap I could do a check like t...
By default, NHibernate lazy loads all collections, which works fine for me in most cases. However, I'm running into problems with some tools that use reflection, which doesn't play well with proxied objects. In this case, I can't serialize an entity using JSON.NET because it throws an exception when it hits a proxied object.
My question...
I'm so stuck with trying to get a simple NHibernate app running. I'm doing "Getting started with NHibernate" step by step.
First, I got a invalid property something error (managed to fix that).
Now, I get an exception:
Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle'
during configuration...
Using a Join and Component together in Fluent NHibernate Mapping throws "Could not find a getter for property exception". This is my C# code
using FluentNHibernate.Mapping;
namespace FnhTest {
public class CustomerMap : ClassMap<Customer> {
public CustomerMap() {
Id(x => x.Id).GeneratedBy.Identity();
...
I am trying to perform an hql query which returns a list of objects with distinct property value. Following is my pseudo code:
string hql = @"select distinct m from Merchandise m
where m.Serial is unique"
I am using Castle ActiveRecord on top of NHibernate. I have spent half a day on this problem but couldn't find the c...
Hi,
We want to use NHibernate behind our WCF service but we are having problems persisting child record deletes to the database.
We use DTO's between the service and client which have IList<> as the child collection type. When we populate a DTO using NHibernate it sets the child collection to be a type of Bag. However, when this is s...
Has anyone gotten Fluent NHibernate to work with Castle ActiveRecord?
I am particularly interested in Automapping to configure entities for use with the ActiveRecordMediator repository.
...
Say I have a query like:
session.CreateCriteria(typeof(Category))
.Add( Expression.Like("Name", someVariable) );
WHere someVariable was taken from the querystring, do I have to do checks against sql injection or will nhibernate handle this?
...
I've seen a few examples of how to write an hbm mapping file that has composite keys and implements a one-to-many relationship but I haven't seen a good example of how to do it with NHibernate.Mapping.Attributes.
So, upon trying this 100 different ways I'm receiving an error:
{"The element 'bag' in namespace 'urn:nhibernate-mapping-2.2'...
public Category GetByName(string name)
{
Category category = Session.CreateCriteria(typeof (Category))
.Add(Expression.Eq("Name", name))
.UniqueResult<Category>();
return category;
}
Or is it so clear that it doesn't need testing?
...
I have 2 entities:
article
category
then a table:
articles_categories
- articleID
- categoryID
I only have mappings for article and category, and no relationships have been setup as of yet.
Is it possible to build a query to get all articles that are in categoryID=234 ?
...
So I have 2 entities:
Article
Category
And I have a table that relates the articleID and categoryID:
articles_categories
-articleID
-categoryID
I am using xml for my mappings, what should I do here?
I want to be able to query for all articles in a given category.
...
Does anybody know how I would map an entity with two many-to-many collections of the same child type.
My database structure is this....
The "normal" relationship will be....
tbl_Parent
col_Parent_ID
tbl_Parent_Child_Xref
col_Parent_ID
col_Child_ID
tbl_Child
col_Child_ID
The alternative relationship is...
tbl_Parent
...
what's the difference between a list and a set?
what about a set and a bag in the mapping file?
...