Nhibernate inserting with values on a bag
I am using a where clause on a bag to filter a bag. Is there any way to make nhibernate insert these filter values into the database? ...
I am using a where clause on a bag to filter a bag. Is there any way to make nhibernate insert these filter values into the database? ...
Is it possible to get NHibernate to generate a query similar to the following with HQL or Criteria API? select * from ( select row_number() over ( partition by Column1 order by Column2 ) as RowNumber, T.* from MyTable T ) where RowNumber = 1 I can get it to execute the inner select using the formu...
Summary: Parent and Child class. One to one relationship between the Parent and Child. Parent has a FK property which references the primary key of the Child. Code as follows: public class NHTestParent { public virtual Guid NHTestParentId { get; set; } public virtual Guid ChildId { get { return ChildR...
Similar but not the same: How to securely store database connection details Securely connecting to database within a application Hi all, I have a C# WinForms application connecting to a database server. The database connection string, including a generic user/pass, is placed in a NHibernate configuration file, which lies in the same ...
I am playing around with Castle ActiveRecord and noticed that the download included the file, Castle.ActiveRecord.Linq.dll. I haven't found any documentation for using Linq with ActiveRecord, only some old blog posts. What is the usage pattern? Is Castle.ActiveRecord.Linq ready for production use? ...
I would like to delete the ICollection PriceBreaks from Product. I'm using the following method. However they dont seem to delete. What am i missing. When i step thru. i notice that "product.PriceBreaks.Clear();" doesn't actually clear the items. Do i need to flush or something? public void RemovePriceBreak(int productId) { using (...
I'm new to NHibernate and can't figure out why these two statements generates different sql. the first one only get the ClientInformation (with Information and Client being Proxies) which is what i want. return repository .CreateQuery("from ClientInformation ci where ci.Information.IsMandatory = true and ci.Client.Id = :cl...
Hi! All examples of fluent nhibernate make such(or similar) call: c.AddMappingsFromAssembly(typeof(Product).Assembly); I don't want tu use "typeof(Product).Assembly" as i don't want to have reference to my domain project here ("Procuct" class). In ordinary NHibernate I would just create hbm.xml files and make following entry in web.co...
I have an application that is now 4+ years old that is exhibiting some odd behavior on our latest deployment. The application uses nHibernate for all inserts / updates / selects, etc. We are currently using .NET 2.0, and nHibernate 1.2 (I know, we need to upgrade) This deployment is on Windows 2008 Server x64, IIS 7.5 - what I have see...
Suppose that I have the following mapping with a formula property: <class name="Planet" table="planets"> <id name="Id" column="id"> <generator class="native" /> </id> <!-- somefunc() is a native SQL function --> <property name="Distance" formula="somefunc()" /> </class> I would like to get all planets and orde...
Hi all I'm somewhat new to the MVC framework and in accordance with the following post: NHibernate with StructureMap I am not sure how to actually get the HttpContextScoped ISession in my controller? I'm sure there is a simple way to do this but I am unsure. Also, it's a small project and I don't want to go overboard with Enterprise D...
In S#Arch based web application I need to read some data during the application initialization. From the first point, the best place - HttpApplication.Application_Start() or HttpApplication.Init() But, Application_Start isn't applicable as there is no WebSessionStorage yet. Init() seems isn't fit as well, as there is no NHibernateSessio...
At the moment my repository has 2 constructors. When i call these from my mvc website i am alway calling first constructor and thus opening a new session. Should i been passing in the session. How should i be doing this. public CompanyRepository() { _session = NHibernateHelper.OpenSession(); } public CompanyRep...
I am trying to write a naming strategy for NHibernate that will prefix table names based on what assembly the poco is defined in. Right now my strategy is just trying to append any prefix at all to the tables just to prove I have things wired up right. The problem that I am encountering is that I am able to create my INamingStrategy ...
I am trying to create an HQL query that will filter a tree based on a user. On the tree root i have AllowUsers and AllowRoles and on each node I have DenyUsers and DenyNodes. I can filter to on the user on the root of the tree using select e from oStructureMenu e join fetch e.Nodes n where e.Id = :id and :user in (select u from...
I am trying to integrate entities defined with ActiveRecord and entities mapped with plain-old .hbm files. I need to have associations between the two, i.e.: ActiveRecordEntity.HbmEntity & HbmEntity.ActiveRecordEntity The only thing I've bumped into that seems at all related is the ActiveRecordMediator but it didn't look like it wou...
I am having a gap in understanding and I would appreciate any help. When I create a HasMany relationship using a list, nhibernate creates an "index" column on my child table. If I query the table using a join, it crashes with "Null Index on collection" What I am not understanding is -- how is this "index" column managed/populated? M...
Hi, I have two database tables that have a many to many relationship: People and Organization. And of course there is a table that connects these two called OrganizationPeople. In NHibernate mapping, they each have a Bag of the other. In People's mapping, the Bag is mapped like this: <bag name="Organizations" table="OrganizationPeop...
I have a Vendor. Every Vendor has several Reservations, with a ReservationDate on it. I want a list of Vendors that have not made a reservation yet today. In SQL I would do something like this: SELECT v.Id, MAX(r.ReservationDate) AS MaxDate FROM Vendor v INNER JOIN DailyReservation r ON v.Id = r.Vendor_Id GROUP BY v.Id HAVING MAX(r....
Hi, I am currently working on a project using NHiberate as the DAL with .NET 2.0 and NHibernate 2.2. Today I came to a point where I had to join a bunch of entities/collections to get what I want. That is fine. What got me was that I do not want the query to return a list of objects of a certain entity type but rather the result woul...