What I do wrong?
<map name="Aspects" table="AspectToEntity">
<key column="EntityID" />
<map-key column="AspectName" type="string" />
<many-to-any id-type="long" meta-type="string">
<column name="AspectName" />
<column name="AspectID" />
</many-to-any>
</map>
Exception:
Repeated column in mapping for collection: Entit...
Please consider the following simple use case:
public class Foo
{
public virtual int Id
{
get;
protected set;
}
public virtual IBar Bar
{
get;
set;
}
}
public interface IBar
{
string Text
{
get;
set;
}
}
public class Bar : IBar
{ ...
As I read here
http://www.theserverside.net/tt/articles/showarticle.tss?id=NHibernate
for example
public class Department
{
private int id;
private string name;
private IDictionary classes;
private IDictionary professors;
}
Why not use Generic List ?
...
How do you call a stored procedure with nHibernate?
Specifically there are two cases where I am using store procedures: to return a scalar value and to return a set of results mapped to entities.
...
Hello!
I have two classes:
public class Person{
public virtual string Name { get; set;}
public virtual Address Address { get; set; }
}
public class Address{
public virtual string Street { get; set; }
}
Now I want NHibernate to give me all Persons where Name is equal to "Xyz" or Address.Street is equal to "Xyz".
This approach...
Hi, I'm trying to work out how to create a query using Linq to NHibernate.
I have two classes like this:
public class Foo
{
private ISet<Bar> _bars = new HashedSet<Bar>();
public virtual ISet<Bar> Bars
{
get { return _bars; }
set { _bars = value; }
}
}
public class Bar
{
public string Name { get; se...
hi all,
I have a User object/mapping in my application. Each user has a list of contact information (phone, email etc)
the mapping for the user contains:
<bag name="ContactInfo" table="contact_info" lazy="true" cascade="all">
<key column="contact_id"/>
<one-to-many class="...ContactInfo, ..."/>
</bag>
this works fine but i g...
I am trying to map a domain model in NHibernate. The domain model is implemented with what I think is DDD style. The mapping works mostly but then when I try to use a collection filter on an a collection I get an exception which says: The collection was unreferenced.
I know the problem comes from how I've implemented the collection. My ...
I use NHibernate (2.0.1GA) with my project. At runtime I get the
Invalid Cast (check your mapping for property type mismatches);
[...]
So it only says its unable to cast something. Thats a bit unprecise imho.
My mapping file is pretty big (master table with about 50 colums plus 11 subsets). How do I find the invalid cast without ch...
Hi!
Normally I'm using criteria api to make queries against my database, but because criteria api seems to have a bug when searching for the same entity twice, I would like to append a custom piece of HQL to the rest of my criteria. Is this somehow possible?
Here is an example of what is not working with criteria api:
public class Per...
I have a simple method that does...
Session.CreateSQLQuery(syntax).List<T>();
The issue is that when I execute this against a stored procedure that enlists a linked server connection I get the following error...
The operation could not be performed because OLE DB provider "MSDASQL" for linked server "MyLinkedServer" was unable to beg...
Whats the best, most consistent way to check if a table exists in NHibernate (or with Fluent-Nhibernate)?
Is it even possible? I mean it seems like a simple task for such a heavy-duty ORM.
Also on a related question, can you check if a set of tables or a whole schema exists with NHibernate?
...
Hi,
I'm having a problem with the first level cache in NHibernate in our web application.
In our application we have a context based session that is alive during each request (opened on request start and closed on request end).
In addition to this we have a model structure with User, Organization and OrganizationType such that each Use...
Given I have a scenario where two users are editing different address object at the same time.*
User 1 edits address.streetname only and saves and User 2 edits address.town and saves.
Is there anyway I can configure nhibernate so that only the changed fields are updated and thus the changes are merged?
I have tied dynamic-update, but ...
I recently had some problems with the hibernate.cfg.xml as I hadn't had the following line in
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
Now that this is fixed I am being shown the following error:
Could not load file or assembly 'NHibernate, Versi...
Hi,
This is my first serious project using NHibernate and I have setup log4net to output the sql generated by NHibernate but after running my web app I cannot find any log files.
This web app is currently being run on my local machine with http://localhost/dispatch. The dispatch directory is a virtual directory in IIS pointing to a pro...
Hey,
Sorry if this seems a little crazy but ive been messing around with NHibernate for a while and have come accross a scenario that may not be possible to solve with NHibernate...
I have 1 database that contains a load of static data, imagine it like a huge product lookup database, just to point out this is an example scenario, my ac...
I have two tables, Vehicle and Make. The two are joined using the MakeId as a foreign key on the Vehicle table. My mapping file looks similar to this
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Demo.Business.Objects.Vehicle, Demo.Business.Objects" table="V...
I am trying to work out how to manage the following relationships
A Store has many Products
A Product is in many Stores
A Store knows how many of each Product it has
In the database I have 3 tables Stores, Products and a StoreProducts that has StoreId, ProductId and Quantity.
How would I map this in nHibernate or fluent nHibernate?
...
I have a suite of integration tests that run inside transactions.
Sometimes it seems that NHibernate transactions are not being correctly rolled back. I can't work out what causes this.
Here is a slightly simplified overview of the base class that these integration test fixtures run with:
public class IntegrationTestFixture
{
priva...