So, I'm having a problem mapping in fluent nhibernate. I want to use a join mapping to flatten an intermediate table: Here's my structure:
[Vehicle]
VehicleId
...
[DTVehicleValueRange]
VehicleId
DTVehicleValueRangeId
AverageValue
...
[DTValueRange]
DTVehicleValueRangeId
RangeMin
RangeMax
RangeValue
Note that DTValueRange does not ha...
I am new to Hibernate world. It may be a silly question, but I am not able to solve it. I am testing many to One relationship of tables and trying to insert record. I have a Department table and Employee table. Employee and Dept has many to One relationship here. I am using Fluent NHibernate to add records. All codes below. Pls help
- S...
Here's a starter list:
if hbm is hand generated, is it an embedded resource?
if using FNH, does it pass a PerssistenceSpecification test?
if not using FNH, can you save and then load the persisted class?
use Ayende's "sanity checks"
I'm sure many of you have gotten this one at one point or another. But have you ever gotten it w...
I'd like to have NHibernate call a stored procedure when ISession.Get is called to fetch an entity by its key instead of using dynamic SQL.
We have been using NHibernate and allowing it to generate our SQL for queries and inserts/updates/deletes, but now may have to deploy our application to an environment that requires us to use stored...
By default the behaviour of FNH is to map enums to its string in the db.
But while mapping an enum as part of a composite key, the property gets mapped as int.
e.g.
in this case
public class Address : Entity
{
public Address() { }
public virtual AddressType Type { get; set; }
public virtual User User { get; set; }
...
I'm getting the error "Illegal acces to loading collection" when i'm trying to get a list of variants belonging to a certain product. The NHibernate mapping is as below;
<list name="Variants" lazy="false" cascade="save-update" inverse="false" table="PluginProduct_ProductVariant">
<key column="ProductId" />
<index column="Ordinal" />...
I am trying to implement a one-to-many relationship using NHibernate 2.1.2 but keep getting "Association references unmapped class" exceptions. I have verified that my hbm.xml files are embedded resource. Here are my classes and mappings. Any ideas?
public class OrderStatus
{
public virtual decimal MainCommit { get; set; }
publi...
Hi guys,
I'm new to NHibernate and am experiencing issues trying to model an IDictionary.
The key of my dicionary is a complex type called 'Identifier' and the corresponding 'value' is of type string e.g. IDictionary<Identifier,string>.
(apologies if the entity name 'Identifier' makes this confusing, its a domain term and I went with ...
I'm doing my auditing using the Events listeners that nHibernate provides. It works fine for all mappings apart from HasmanyToMany mapping. My Mappings are as such:
Table("Order");
Id(x => x.Id, "OrderId");
Map(x => x.Name, "OrderName").Length(150).Not.Nullable();
Map(x => x.Description, "OrderDescriptio...
Hi All
I'm attempting to use an HQL query in a <loader> element to load an entity based on other entities.
My class is as follows
public class ParentOnly
{
public ParentOnly(){}
public virtual int Id { get; set; }
public virtual string ParentObjectName { get; set; }
}
and the mapping looks like this
<class name="ParentO...
Hi,
I have 3 tables (Many to Many relationship)
Resource {ResourceId, Description}
Role {RoleId, Description}
Permission {ResourceId, RoleId}
I am trying to map above tables in fluent-nHibernate. This is what I am trying to do.
var aResource = session.Get<Resource>(1); // 2 Roles associated (Role 1 and 2)
var aRole = session.Get<Ro...
I'm dealing with a legacy database that has date and time fields as char(8) columns (formatted yyyyMMdd and HH:mm:ss, respectively) in some of the tables. How can i map the 2 char columns to a single .NET DateTime property? I have tried the following, but i get a "can't access setter" error of course because DateTime Date and TimeOfDay...
Hi
First I will try to explain what I want to do.
The app loads a NhHibernate config file and parse the xml, allowing changes to the connection string and the mapping assembly.
The problem is that when I run the app in the directory that contains NHibernate.dll and all references, it works well, but if I run the app from other direc...
I am working with a legacy database that stores "blank" values as a single space. Is there a way with Fluent NHibernate, either by way of a convention or mapping override, that I can translate this "blank" value as a .NET null? (I know that I will need to save nulls to this database as a single space still but I will use an save event ...
Hi!
I've been wrecking my mind on how to get my tagging of entities to
work. I'll get right into some database structuring:
tblTag
TagId - int32 - PK
Name
tblTagEntity
TagId - PK
EntityId - PK
EntityType - string - PK
tblImage
ImageId - int32 - PK
tblBlog
BlogId - int32 - PK
class Image
Id
EntityType { get ...
Hi Friends,
I got following error whenever anything in project is going to be updated. I am unable to understand what this error message trying to tell. can any body help me in to this.
Server Error in '/' Application.
Unexpected end of file has occurred. The following elements are not closed: hibernate-configuration. Line 1, position ...
I have the following class
public class Person
{
private IList<Person> _children;
public IEnumerable<Person> Children { get; }
public void AddChild(Person child)
{
// Some business logic and adding to the internal list
}
}
What changes would I have to make for NHibenrate to be able to persist the Child co...
I am trying to integrate NHibernate into an existing application with several hundred tables. Due to the fact that there apparently wasn't a strict adherence to conventions, I am unable to use Automap. As a result, I'm going to use Fluent to manually map over all of the associations.
Rather than doing it by hand, I'm hoping that there i...
My User table I want to map to aspnet_Users:
<class name="User" table="`User`">
<id name="ID" column="ID" type="Int32" unsaved-value="0">
<generator class="native" />
</id>
<property name="UserId" column="UserId" type="Guid" not-null="true" />
<property name="FullName" column="FullName" type="String" not-null="t...
i'm working w/ a legacy database is set-up stupidly with an index composed of a char id column and two char columns which make up a date and time, respectively. I have created a ICompositeUserTypefor the date and time columns to map to a single .NET DateTime property on my entity, which works by itself when not part of the id. i need t...