nhibernate

NHibernate - Exclude a property from a projection list (select clause)?

I have classes that look like this public class Agreement { public virtual string ArrgKey { get; set; } public virtual string SubjectCode { get; set; } // mapped as a HasMany to AgreementStateCountyRelation public virtual IList<AgreementStateCountyRelation> StateCounties { get; set; } } public class AgreementStateCount...

nhibernate connection release modes: why does the documentation recommened using "after_transaction"?

The hibernate documentation states the following: The configuration parameter hibernate.connection.release_mode is used to specify which release mode to use. The possible values: *auto (the default) - equivalent to after_transaction in the current release. It is rarely a good idea to change this default behavior as failures due...

No persister for Entity

I define a simple Bug Class: using System; namespace BugNS.Entities { class Bug { public virtual int Id { get; private set; } public virtual int BugNumber { get; set; } } } and a simple mapper class: using System; using FluentNHibernate.Mapping; using BugNS.Entities; namespace BugNS.Mappings { class ...

NHibernate Oracle mapping problem

Before stating the problem, please look at the code Database(Oracle) SQL: create table test_tab( id number, Name varchar2(50) ); Corresponding Class in C#: public class TestTable { private long id; public virtual long Id { get { return id; } set { ...

NHibernate mapping - how to achieve this

Hello! I have been trying for quite a while to work out how to accomplish my mission, and in fact I am not even sure that the direction I am heading in, is indeed a diserable one in terms of my SQL tables - but it is the most concise I have been able to think up on. My problem is fairly simple to describe. I have a table containing com...

NHibernate - How to delete a child from a bidirectional many-to-many assocation?

Hi! How can I delete a child from a bidirectional many-to-many association? Deleting the child does not work because I get an exception (FK Violation). Just removing the child from the parent and call saveorupdate on the parent does not do anything. Entities: public class Employee : Entity { public virtual string LastName { get...

Custom Id column in the Fluent NH entity name

I am using S#arp architecture with Fluent Nhibernate and Automapper on a legacy DB. The id column of one of the tables is different from the Automapping convention and therefore I tried to override it without success. I end up with this error FluentNHibernate.Cfg.FluentConfigurationException : An invalid or incomplete config...

Nhibernate Cascade

What does Cascade in Nhibernate mean? I see a lot of options in cascading: Delete All AllDeleteOrphan DeleteOrphan SaveUpdate Can you explain these with with examples and their distinctions? ...

NHibernate Filter as a row level security layer

Hello, I would like to use NHibernate Filters to hide some rows from users, according to different permission sets. Can I call a stored procedure from the filter? Are there any scenarios in which a filter won't filter records, or will cause an error? Thanks! ...

How do I use the guid.comb strategy in a MySql db.

Is it possible to use the guid.comb strategy for identity generation with Mysql Db using Nhibernate? When I use it as mapping.Id(x => x.Id) .Column("row_guid") .CustomType(typeof(string)) .GeneratedBy.GuidComb() .Length(36); I end up with a ----> System.InvalidOperationException : Identi...

Help with nhibernate

Question: I have an annoying problem with nhibernate. The problem is I cannot get any example I find on the web to work... I've now tried for two days... The first problem was it wouldn't read the config file, so I had to move it into app.config / web.config. The second problem is that whatever I do, I always get an error: No persiste...

Npgslqexception unhandled

Hi. I am a little confused of the following issue. I am using NHibernate with Postgres database. Executting the following statement: try { //make a query } catch { }, however, the CLR reports an unhandled NpgsqlException since I do not have a column in the database. The question is why the unhandled exception gets reported, if I incl...

NHibernate Many to Many table is not updated

I have a 3 tables which are "News", "Tags", "News_Tags" with Many-To-Many relationship. With the following mapping the "News" and "Tags" table have been updating, but "News_Tags" has not been updated. Can anyone help me? News: <class name="News" table="News" lazy="false"> <id name="NewsID"> <generator class="identity" /> </i...

Cascade issue when deleting an entity in a one-to-one relationship using Fluent NHibernate.

I have the following db tables which I have simplified for this example: Webpage Id, URLIdentifier WebpageMetaData Webpage_id Keywords Webpage_id is the primary key for the table and a foriegn key back to the webpage table. I am then using Fluent NHibernate and its automapping feature to map these to the following POCO classes: publ...

Question about retrieving (sort of) unmapped entity in nhibernate

I have a custom CMS implementation where each article can be linked to a list of tags. the nh mapping for this part looks like this: <bag name="Tags" lazy="true" table="CMS_Articles_Tags" cascade="all-delete-orphan" batch-size="10"> <key column="article_id"/> <element column="tag" type="string"/> </bag> the rest of the mapping is ...

ROW_NUMBER() and nhibernate - finding an item's page

given a query in the form of an ICriteria object, I would like to use NHibernate (by means of a projection?) to find an element's order, in a manner equivalent to using SELECT ROW_NUMBER() OVER (...) to find a specific item's index in the query. (I need this for a "jump to page" functionality in paging) any suggestions? NOTE: I don't...

NHibernate one to many problem

Hi I'm trying to map some tables using Nhibernate and it generally works apart from when it comes to one-to-many classes. I have a Visits table where each visit has many Inspection records. The mapping file for Visits contains the following: <bag name="Inspections" lazy="false" fetch="select" cascade="none" inverse="true"> ...

How do I map List<List<EntityClass>> in NHibernate?

I have a Rotation class, which contains references to multiple lists of Advert objects. I would prefer an implementation where Rotation has a property of type List<List<Advert>> to hold these, but I am unable to come up with an NHibernate mapping supporting this. In the database schema, the many-to-many relation between Rotation and Adv...

HQL: Querying dynamic-component property

If I have a mapping like this: <class name="Library" table="Libraries"> ... <dynamic-component name="Annotations"> <property name="LibraryResolver.AlgorithmVersion" column="`LibraryResolver.AlgorithmVersion`" type="Int32" /> </dynamic-component> </class> How should I write HQL or Linq-to-NHibernate query for all libraries wh...

Nhibernate doing updates on select?

Hi, I have the following class: public class Product { public virtual Guid Id { get; set; } public virtual string Name { get; set; } public virtual Decimal PricePerMonth { get; set; } public virtual BillingInterval DefaultBillingInterval { get; set; } public virtual string AdditionalInfo { get; set; } } and the mapping look...