We have a fairly big DB (~200 tables) which almost entirely uses composite primary keys and composite foreign keys, using a single "base table" from which every other table inherits part of its primary key:
Parent has single column primary key ParentId
Child has composite primary key (ParentId, ChildId) and foreign key ParentId
Nephew ...
I have a legacy database with 3 tables like this:
The Items table contains all the Items in a Plan.
The Structure table defines the relation between the items.
A parent item is defined by company, year, planId and parentItem of table structure mapping to company, year, planId and id of table item.
A child item is defined by company, yea...
In hbm mappings I can
<composite-id>
[..]
<key-property name="someStringProperty"
column="somefield"
type="AnsiString"
lenght="8"/>
</composite-id>
How do I do that (setting type and length) in Fluent?
Edit:
I posted this on support.fluentnhibernate.org. I included some modi...
Hi
We have a large management application and we do alot of logging for every action, who did what and at what time.
However we have more and more automatic systems which we would like to differentiate aswell.
In all our tables we have a column called PerformedBy which is an int.
This has always been a reference to a Table called Emplo...
Hi guys,
In short, the problem is that, when add child object to the collection property of the parent object without explicit setting the parent property of the child object, the insert will fail. Let's take a example:
NOTE: I'm using NHibernate 3.0 beta1.
Example: Product-Category Senario:
(1) Database Schema:
Category (Id, Name)...
I have just started to learn NHibernate, and are following tutorials. On my own learning project, I have made up a problem for myself. I have two tables:
Team:
TeamId*
Name
Match:
MatchId*
TeamAId
TeamBId
The model entities are:
Team
public virtual int? TeamId { get; private set; }
public virtual string Name { get; set; }
public v...
I'm using Fluent NHibernate in an attempt to improve testability and maintainability on a web application that is using a legacy database and I'm having some trouble mapping this structure properly:
I have two tables that really represent one entity in the domain, and so I'm using a join to map them as such, and a third table that repre...
I have three classes mapped using the table-per-subclass class mapping strategy. The tables are:
Images - ImageId, FileName, ImageData
CategoryImages - CategoryId, ImageId
ProductImages - ProductId, ImageId
We are mapping like so:
<class name="CatalogImage" table="Images">
<id name="Id" column="ImageId">
<generator class="guid.com...
I have two entities that I need to treat polymorhically, each of which has a similar "business id" type of property. As you might expect, there is semantic meaning to each id in the domain, and there is an object type to represent it. In one entity, a Project, the domain language of this property is a ProjectCode. In the other entity, an...
I can't get NHibernate to delete this child object, it completes without throwing any exceptions and without deleting anything:
public void DeleteW9(int vendorId, int vendorW9Id)
{
var vendor = vendorRepository.Get(vendorId);
var W9 = vendor.W9.Where(x => x.Id == vendorW9Id).First();
vendor.W9.Remove(W9);...
I have an NHibernate object that is a superclass (let's call it "Super"), and a subclass that inherits from it (let's say it's called "Sub").
<class name="Super" table="SuperThings">
<id name="Id" type="System.Int32" column="SuperId">
<generator class="identity" />
</id>
<joined-subclass name="Sub" table="SubThings...
Hi all,
I'm currently building a web application with MVC and NHibernate. Now when i want to get information out of the database I get an index was out of range exception.
The current situation is as follows.
I got the mapping files of three database tables:
A table to store a group with a one-to-many relationship with subscriberingro...
I'm using NHibernate to persist my Item class to a SQL database. The Item class has a property Item.Tags of type ICollection<Tag> which I am mapping using the following NHibernate configation.
<set name="Tags" table="TagLinks" cascade="all" lazy ="false">
<key column="ItemId" />
<many-to-many class="Tag" column="TagID" />
</set>
A...
Given a parent child relationship between User and FailedLogin where a user has many failed logins. I'd like to map this into
class User
{
public virtual FailedLogin LastFailedLogin { get; set; }
}
class FailedLogin
{
public virtual User User { get; set; }
public virtual DateTime AttemptOn { get; set; }
}
So that the Las...
I am new to NHibernate and I'm trying it out by porting a small webforms app to use it. I am trying to figure out if its possible to map (hmb.xml maps) the following assignments:
public class Foo
{
public List<Bar> Children { get; set; }
public void AddBar(Bar b)
{
Children.Add(b);
b.OwnerCollection = Childr...
Dear All!
This may be a really silly question, but I've found no answer on google/bing...
If I already use NHibernate for persistence with SQL Server, why should I then create all the table-relations on the database-schema?
I'm just wondering because it seems to create all the relations, altough I already have defined them in the NHibe...
I have a little doubt for mapping of property in hbm file.
Sometimes I've mapped the string field of my db in this way:
<property name="MyPropName" column="MyColumnName" length="20" />
but the same mapping can be wrote in this way:
<property name="MyPropName" column="MyColumnName" type="String(20)" />
my question is...what's the b...
Hello guys...
Can you help-me with that database :
I´m using Fluent NHibernate, but XML helps too...
My problem is with ProductPrice table...
Thanks
Paul
...
I have a set of entities that implement an interface:
public interface ILocalised
{
Culture Culture { get; }
}
For lots of complicated reasons I need to filter entities which do not have the correct culture after they are returned back from the DB (i.e. I can't use a Filter). My immediate thought was to create an interceptor that ...
I have an existing many-to-many relationship in SQL that is being mapped to my business entities via NHibernate.
I want to add a property to the child (Category below) that is only applicable to the relationship between the parent and the child. In SQL, I would add a field to the join table.
How do I use NHibernate to pull that value ...