nhibernate

HQL restriction on child collection

I have a class which has a collection public class Parent { ... ISet<Child> Children; ... } Given a list of child names, I'd like to return parents whose Children property contains all items of this list. I managed to write an HQL query, but it works for a single name, not a whole list : SELECT p FROM Parent AS p JOIN p....

Creating a many-to-many relation between an entity and an another many-to-many relation with (N)Hibernate

I'm trying to create a many-to-many association between an entity and another many-to-many association. How can that be done? I followed the Customer/Order/Product example to attach custom properties to a many-to-many association between two of my entities (Categories and Tags). That worked like a charm. The problem is that now I need ...

Who owns the IP rights for nHibernate and Castle?

Hi, Who owns the IP rights for nHibernate and Castle? I am aware that they are open source, but is there a company/individual who holds the IP for these? Thanks ...

single-table-per-hierarchy mapping error

I got the following mappings <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="false"> <subclass name="Module.CRM.Models.CallRecord, Module.CRM" extends="Gate.Calls.CallRecord, Gate.SDK" discriminator-value="call_record_id"> <property name="ContactId" column="contact_id" /> ...

nhibernate inheritance

I have two tables: call_records crm_call_records call_records do not know that crm_call_records and their corresponding classes exists in different assemblies. I can therefore not add a subclass mapping in the mapping file for call_records. crm_call_records has a column named call_record_id which contains the value of the PK in cal...

How to avoid unnecessary joins in NHibernate

Hi, I've got a class named 'Entity', which can be individuals or organizations. I have a few other classes that are descendants of Entity, which have their properties defined in extension tables in my database. One of my descendants is named 'User'. A really truncated example of my table structure: Table: ENTITY Id - UniqueIdentifie...

NHibernate: Is it possible to use stored proc when updating/deleting/inserting a class mapped on view?

Here is the preamble: I have a SQL View and mapped NHibernate C# class I only allowed to modify SQL View data through some stored procedures (Insert/Update/Delete) How to denote such logic in mapping file? Is it possible with only specific mapping or i need some supplementary code? ...

Composite Id's and Restrictions.IdEq or with comparison in Linq not working as expected

I have an entity where a composite id is used. I changed to code to make use of wrapping the composite id in a seperate key class. I expected that with Linq I could do a comparison on key object and with the Criteria API to use Restrictions.IdEq but both fail. I need to explicitly compare the key values to make it work. I cannot find an...

Auto Increment in FLuent Nhibernate and PostgreSQL

Hai, I`m Newbie in Fluent Nhibernate.. I have postgreSql Database and what i want is generated id with auto increment.. i have no see feature auto increment in Postgres and i was understand that for use auto increment in postgreSql i must create sequence.. there is other way beside sequence? if create sequence is the only way, can You ...

NHibernate connection string containing Provider

Hello, i've crrently got a problem where our applications are using NHibernate implementations where some older parts still use ADO. The problemn i'm having is that ADO requires a provider to be specified in order to work. Provider=SQLOLEDB.1;Persist Security Info=False;User ID=XXXXX;Initial Catalog=XXXX;Data Source=XX.XXX.XX.XX;Passwor...

Implementing hilo (or seqhilo) in NHibernate and Oracle

Hello guys, I have a database (which I can not modify) with 6 tables in Oracle 11g. All tables have a OID artificial column for ID, and its type is RAW(16). The DBA answered me that they are in raw and not in integer because this way the IDs will be unique in all six tables - and we must guarantee that. I'm developing the UI in C# and ...

ICriteria query - finding objects whith certain properties in their lists

Hi, I have a class B which contains a string 'b'. I also have a class A which contains a list of Bs (IList) called list. I would like to find all distinct objects of A which contain B objects that contain the string 'bla' in the string 'b'. Is this possible? Thanks. Christian ...

NHibernate HiLo as long

Hi, I will have a table with more than 7 billion rows so I need log for primary key. How to specify the HiLo to use In64 instead of int? Thanks ...

How can I trace an apparent memory leak in an asp.net application?

Some background info: We have several websites running on a 64-bit machine with IIS6 These websites all have the same core code, but different skins and content We have a SQL 2005 database which is fairly heavily used throughout the site Historically we've used SQL stored procs, but have been gradually transitioning to NHibernate. The ...

NHibernate one-to-one mapping, non-primary keys

Can't get NHibernate to generate the correct query. It keeps using the primary keys of the two tables I'm joining for the one-to-one relationship, and I can't figure out how to specify the foreign key in one of the tables. tableA tableB { aID, { bID, bID, z, c, y, d } x } so the tableA should jo...

Tradeoffs using NHibernate 3.0 QueryOver or LINQ provider

I have not found a clear comparison of what is supported with the NHibernate 3.0 LINQ Provider compared to using the QueryOver syntax. From the surface, it seems like two large efforts into two very similar things. What are the key trade offs to using each? ...

Using GUID with SQL Server and NHibernate.

I'm running NHibernate and SQL Server CE I am trying to use GUIDs as my ID column. This is the code I already have: Mapping: <class name="DatabaseType" table="DBMON_DATABASE_TYPE"> <id name="Id" column="DATABASE_TYPE_ID"> <generator class="guid" /> </id> <property name="DispName" /> </class> And this is the cre...

StructureMap default instance overloading with explicit arguments, error 205

I have a class: public class SystemQuery<T> : ISystemQuery<T> where T : class, IUIView { protected ISession session; protected ICriteria baseCriteria; public SystemQuery(SessionContext sessionContext) { this.session = sessionContext.Session; this.baseCriteria = session.CreateCriteria<T>(); } publi...

Get metadata about components in NHibernate

So, you can use NHibernate.ISessionFactory.GetClassMetadata(System.Type) to get information about a mapped entity class in NHibernate. However when the type is mapped as a component, GetClassMetadata blows up with an exception stating that the class is not an entity. Is there a way to retrieve metadata information about a mapped compon...

problem with creating a query using criteria in nhibernate

I want to reproduce the following query using criteria: select a.ID as article, count(c.ID) as commentsCount from Comments c left outer join Articles a on a.ID=c.ArticleID where a.ID in (2,10) group by a.ID I wrote it, but somewhere I must have an error, because the result is different than I expected. The criteria: ICriteria crit...