Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
20 views

Fluent NHibernate multiple tables with shared data models

I work with a database with several practically identical tables. For illustrative purposes they look like this: CREATE TABLE MyTable ( Id INT NOT NULL, Title VARCHAR(255) NOT NULL ) INSERT ...
TheHvidsten's user avatar
  • 4,384
0 votes
1 answer
73 views

nhibernate has invalid child element 'add'

I'm having issues running my application where it uses NHibernate. The runtime issue I'm getting is: The element 'session-factory' in namespace 'urn:nhibernate-configuration-2.2' has invalid child ...
Blues's user avatar
  • 3
0 votes
1 answer
23 views

FluentNHibernate exception when there are slash in the default value

I have been trying to map a string value using FulentNHibernate like below. Map(x => x.FilePath).Length(500).Not.Nullable().Default(@"C:\Program Files\server\data\conf\groups.txt"); But ...
Kavin404's user avatar
  • 1,029
0 votes
1 answer
49 views

Can I use NHibernate.Cfg.Configuration in Fluent-NHibernate when building a session factory?

I want to use the NHibernate configuration for FluentNhibernate when building a session. This how I am constructing my factory session: lock (_factorylock) { if (_factory ==...
user avatar
0 votes
1 answer
83 views

FluentNHibernate.Cfg.FluentConfigurationException NHiberNate

I get an error like this when writing unit test My product class is like this. I added virtual. My map is like this. SqlServerHelper like this. I am using vs code 2022. I'm developing with Net 6.0 ...
Gökay Açıkgöz's user avatar
0 votes
0 answers
71 views

Calling stored procedure on Inherited class in [Fluent] NHibernate without discriminators

I have a working Fluent project with some inherited tables class Base { int BaseId } class Derived : Base {} class Derived2 : Base {} class BaseMap : ClassMap<Base> { ID BaseId ); } class ...
Aero9999's user avatar
  • 142
0 votes
0 answers
98 views

Fluent NHibernate Mapping multiple tables has relation and joined to each other

As you see the models have references as one to many. list of project is not mapped here. there are more than one project and the project has more than one role and the role has more than one ...
Hafizullah Ozgur's user avatar
-1 votes
1 answer
308 views

NHibernate PropertyRef fluent mapping

Is there any way to make query over joins on different nullable foreign key? Release notes: https://github.com/nhibernate/nhibernate-core/blob/5.2.4/releasenotes.txt#L103 A collection mapped with a ...
Tomas Aušvicas's user avatar
0 votes
1 answer
86 views

Map a dictionary with a custom key type using FluentNHibernate

I need to map a Dictionary<TenthNm,double> in one of my ClassMaps, but the key is custom type (essentially, TenthNm is an object that has only an int property). There is a similar question, ...
Jakob's user avatar
  • 659
0 votes
1 answer
118 views

How to include records from 2 db tables into a single view using NHibernate / Fluent NHibernate?

I'm new to NHibernate / Fluent NHibernate (started with it this weekend) and I'm having difficulties solving the following. I have 2 SQL Server tables: [Client] ID INT NOT NULL ...
Victoralm's user avatar
  • 203
2 votes
1 answer
562 views

Insert nested object via JSON using web api with NHibernate

I'm writing an application that consist of a ReadAPI and a WriteAPI. The read API contains the domain classes, and uses EF CORE code first to generate the SQL DB, and to read from it. The write API ...
Stefan Eeckhoudt's user avatar
1 vote
0 answers
331 views

nHibernate HasMany with Join Table

I am trying to create a One to Many relationship with a Join table and I an having a hard time trying to do it. Below is the tables structure, Entities and Maps in C# CREATE TABLE tbl_configurations ( ...
delucaezequiel's user avatar
0 votes
1 answer
216 views

Fluent NHibernate Mapping Doesn't Work For Some Tables

I'm using Fluent Migrator and Fluent NHibernate in the same project but when I launch queries using Database.Session.Query<ENTITY>().** some return data and some don't. I can't tell where I'm ...
oividiosCaeremos's user avatar
0 votes
0 answers
128 views

Is there a way to override the DefaultSchema of a fluent nhibernate configuration in the map class?

Background I am working on a .net standard 2.0 library that is using FluentNhibernate 2.1.2. Its fluent nhibernate configuration is set to use a default schema. Fluently.Configure().Database(() =>...
pa001's user avatar
  • 1
0 votes
1 answer
536 views

Problem mapping reference to composite key with Fluent NHibernate

I have a class named... "ClassA" that has an int ID as primary key. I have a class named "ClassB" that has a composite primary key formed by an Id, a ClassAId that is a reference to ClassA, and ...
xecollons's user avatar
  • 598
0 votes
1 answer
632 views

FOREIGN KEY constraint failed when trying to delete entity referenced in value object

Domain of interest I'm writing a POS software. It has a concept of money transfer means, some of which are physical. Each physical means allows some denominations which are essentially a ...
Spotted's user avatar
  • 4,081
9 votes
3 answers
394 views

Mapping the same entity to different tables

A bit of domain knowledge I'm writing a POS (Point Of Sales) software which allows to pay goods or to refund them. When paying or refunding, one need to specify which money transfer mean to use: cash,...
Spotted's user avatar
  • 4,081
0 votes
0 answers
99 views

Fluent hibernate and automapper inheritance

I have three entities: BaseEntity (Guid Id) Primary key (for all entities) Person (Name, FamilyName) : BaseEntity Employee (Salary) : Person How to map Employee so that its Primary key was also a ...
John's user avatar
  • 1,903
1 vote
1 answer
215 views

Oracle IN clause with tuples using NHibernate components

I've declared some entity (named Employee) with FluentNHibernate mapping using CompositeId and ComponentCompositeIdentifier. My component identifier (named Person) consists of two fields: LastName ...
Дмитрий Сидоров's user avatar
0 votes
1 answer
227 views

Fluent NHibernate Cascade All not saving list of children with composite id

I am trying to save an object Allocation : public class Allocation : DomainEntity { public Allocation() { this.AllocationsTitres = new List<AllocationTitre>(); } public ...
WizLiz's user avatar
  • 2,088
0 votes
1 answer
158 views

Multiplicity constraint violated Error while loading entity

I've seen this question been asked number of times but each has its own scenario and i couldn't find solution. I wanted to add a table that holds a survey data, and each SURVEY belongs to a SITE. ...
AlphaTry's user avatar
  • 485
1 vote
1 answer
477 views

FluentNHibernate: Default precision of DateTime changed?

I am currently trying to migrate from FluentNHibernate 1.4 / NHibernate 3.4.1 to FluentNHibernate 2.1.2 / NHibernate 5.2.4. The used database is DB2 LUW 11.1, the .NET target framework is 4.61. The ...
Udontknow's user avatar
  • 1,558
1 vote
1 answer
554 views

Two tables with the same structure and schema but different names requiring inserts and updates to one table - NHibernate

I have two different tables with the same structure and schema in one database. Comp.Employee Comp.EmployeeTemp Entity class: public class Employee { public virtual string Name {get;set;} } ...
Stack Undefined's user avatar
-1 votes
2 answers
486 views

Create Object by Constructor in Object Mapping

I have following Address object: public class AddressObject { public string Postcode { get; set; } public string City { get; set; } public string Street { get; set; } public ...
Snickbrack's user avatar
1 vote
1 answer
363 views

C# - FluentNHibernate Mapping, How to map a non key column in a table with a generator

I'm using Firebird DB and in NHibernate I've mapped my entity as mentioned below. As REQUIREMENTSHID is a primary key I can easily map it to use a DB Generator's value i.e "GEN_REQUIREMENTSH". I'm ...
AlphaTry's user avatar
  • 485
1 vote
1 answer
307 views

Save all string values in lowercase

I would like to lower case all string values before saving them do db. Is there any way NHibernate can do this and how ? Also are there any performance implications that I should be aware of ?
user avatar
-1 votes
2 answers
234 views

NHibernate + fluent mapping + NLog = No mapped documents found in assembly

I've successfully used the CommonLogging layer in NHibernate to log its internal messages using NLog for previous projects which were using hbm.xml files. I'm now switching to fluent mapping, and the ...
Bogdan Stăncescu's user avatar
0 votes
1 answer
108 views

NHibernate Delete Many-to-Many Parent and Child

I have 3 classes. Company, Address and Offices. Following are the entities definition. Company: public class Company: Identity { public Company() { Offices = Offices ?? new List<...
Zeb-ur-Rehman's user avatar
0 votes
2 answers
239 views

fluent nhibernate one-to-many mapping without References method

Assume I have two classes related by one-two-many: public class Customer { public virtual Guid Id {get; set;} public virtual string Name {get; set;} public virtual IList<Order> ...
Tal's user avatar
  • 653
2 votes
1 answer
142 views

NHibernate JOIN mapping fails when the mapped field is moved to a base class

Having two model classes with many common fields, I decided to create a base class and both of them to inherit from it. The existent model classes already came with map classes. All the common ...
Adrian Chiritescu's user avatar
0 votes
1 answer
363 views

NHibernate set fetch strategy

I'm using NHibernate with fluent api and got MainEntity mapping like this: mapping.References(c => c.Parent1).Not.Nullable().Fetch.Select(); mapping.HasMany(c => c.Children1).Fetch.Select(); ...
mike_grinin's user avatar
0 votes
1 answer
361 views

Nhibernate added duplicate column on insert

I'm using Fluent NHibernate. I have a class called Audit which has ItemID property. Everytime that I want to save anything in that table give me this error. Error message: The column name 'itemid' ...
Fereshteh Rabet's user avatar
1 vote
1 answer
603 views

MappingException: No persister for in N-tier application with fluent mapping

I have following project's structure: My models are in NHibernateTesteWeb.Domain.Entity and my maps are in NHibernateTesteWeb.Data.Map Here is my Company class: namespace NHibernateTesteWeb....
Kane's user avatar
  • 33
1 vote
1 answer
321 views

Fluent Nhibernate map a collection to a generic entity

First of all, sorry for my poor english. I'm working on a project and i got to map some legacy tables with a new system running with Nhibernate. This system has a common table (DAT_DADO_EXTRA) to ...
Fabricio Casali's user avatar
3 votes
1 answer
467 views

Fluent Nhibernate error Foreign Key

I know that this issue has some questions about it, but I can't find the right answer, so please let me ask this question to see if someone could give me the right answer I have the following scheme ...
a.ras2002's user avatar
  • 385
0 votes
1 answer
135 views

Nibernate Fluent with interface domain model and inheritance not saving - Unable to resolve property

I have uploaded a gist the has a working sample, the mapping files, and the full debug log that shows the issue - https://gist.github.com/ravensorb/14193136002adbb3ec2fac07c026f921 Here is the actual ...
Shawn Anderson's user avatar
0 votes
1 answer
774 views

Fluent NHibernate duplicate row on one-to-many reference

in my project I have a problem with a one-to-many reference. Actually I have three dto referenced to create a many-to-many reference: User one-to-many RoleGroup Role one-to-many RoleGroup A user ...
Lollo's user avatar
  • 615
0 votes
1 answer
224 views

NHibernate Mapping for string Foreign Key with specific type

I'm trying to map a string foreign key in NHibernate. This works but the field is a varchar(10). This is causing performance problems and the script is timing out because NH is using a nvarchar(4000). ...
Stu's user avatar
  • 2,436
0 votes
1 answer
79 views

NHibernate mapping: references with additional constraint

Lets say I have this class public class LinkingTable { public int PrimaryKey { get; set; } public int LinkFk { get; set; } public string LinkTable { get; set; } public OtherTable ...
ZrSiO4's user avatar
  • 146
0 votes
1 answer
221 views

Fluent NHibernate - many to many with additional table - Cannot insert the value NULL Exception during deletion

I have a many-to-many relationship with additional table and when I am trying to delete a A object which also has a reference in AB table below error occur: $exception {"could not delete ...
gabrieln's user avatar
1 vote
1 answer
1k views

How can I make a where clause on a reference in fluent-nhibernate mapping

There exists such a method on HasMany and HasManyToMany but for some reason there isn't such a mechanism on References. We have an object that references an other object that can be updated and saved ...
Jimmy Byström's user avatar
-1 votes
1 answer
419 views

What do inverse and readonly attributes do in NHibernate napping do?

While I am working a project I have seen this line of NHibernate mapping HasMany(entity => entity.Tasks).KeyColumn("APPLICATION_ID").Cascade.AllDeleteOrphan().ReadOnly().Inverse(); it is the ...
mohaidar's user avatar
  • 4,211
2 votes
2 answers
900 views

Exception on mapping On-To-Many in one table. Could not find property nor field X in class Y

I try to create a tree in single table using Fluent Nhibernate. Table must look like this: Model class: public class Category { public virtual int CategoryId { get; set; } public virtual ...
user6408649's user avatar
  • 1,305
-1 votes
1 answer
5k views

FluentNHibernate: An invalid or incomplete configuration was used while creating a SessionFactory

So, I have a problem with FluentNHibernate. I've mapped all the properties, I've linked my tables and I get an error: An invalid or incomplete configuration was used creating a SessionFactory. ...
bobtimista's user avatar
1 vote
1 answer
710 views

Fluent NHibernate Database First Configuration

I am new to Fluent Nhibernate. We have started using it for a Back office application for Data Access. The client already has a Database with them so we would like to use the Database first approach ...
Dinny's user avatar
  • 475
2 votes
1 answer
785 views

Is it possible to use NHibernate with just Dataset in c#

Sorry, if this is silly question. Is it possible to use NHibernate with just Dataset in c#? I mean I don't intend to have any database but will update my other application upon events triggered over ...
VyshuRam's user avatar
0 votes
1 answer
386 views

Fluent NHibernate Three-Level Sub-Class Mapping

I have a complex NHibernate structure to store our 3 level product hierarchy. When I try and save at level 3 (ProductDetail2), I get the following error: Row was updated or deleted by another ...
maurocam's user avatar
  • 491
0 votes
1 answer
439 views

Fluent NHibernate Conventions : OptimisticLock.Is(x => x.Version()) doesn't work

I am having problems with using OptimisticLock as a Convention. However, using OptimisticLock within Individual ClassMap's works fine. It throws Stale State Object Exceptions. Each Class ...
Venu Amudala's user avatar
0 votes
0 answers
40 views

Fluent NHibernate - ¿How can i map 3 parent tables to the same child table?

I have 3 parent tables pointing to the same child table. I need to write the mapping. I've tried with "HasManyToMany" but i only achieved inserted two fields into the child table instead of the 3 ...
moisesJ's user avatar
  • 36
0 votes
1 answer
1k views

Map Postgis Point to Point in C# using Fluent NHibernate

I am working on Mapping Spatial geometry(Point) On Postgresql to C# Code I need something like example in this question like example in this question but using Postgresql Instead of SQL Server I did ...
Mostafa Bayomi's user avatar

1
2 3 4 5
13