How can I force NHibernate to do a RIGHT outer join or an INNER join instead of a LEFT outer join on a many to many collection?
The reason I would want to do this is because of filtering applied to the collection elements. With a left join, you get the same number of rows returned as an unfiltered query, but the elements that are filter...
I have a unique situation working with a legacy application where I have a parent/child relationship that is based on two integer values. Unfortunately, these fields are not id and parentId or something similar. The columns are ItemId and SubItemId. When these two columns equal each other, the item is assumed to be a parent. When the...
Hi,
Got an annoying problem here. I've got an NHibernate/Forms application I'm working through SVN. I made some of my own controls, but when I drag and drop those (or view some form editors where I have already dragged and dropped) onto some of my other controls, Visual studio decides it needs to execute some of the code I wrote, includ...
Just started developing a project using NHibernate and Fluent NHibernate for the mapping and I'm confused. Since the project is going to get more complex over the next months I would like to structure the code into logical layers such as Persistence Layer and Business Logic layer.
I have a business object called Patient that contains lo...
I am attempting to create a simple database application which keeps track of loans of various types of equipment using Fluent NHibernate and SQLite. However, when I try to generate the database structure with SchemaExport for use in unit testing, foreign keys for one-to-many relationships aren't created.
Here is my Equipment entity:
pu...
I'm using NHibernate to access an MySQL database using InnoDB tables. I know InnoDB doesn't support nested transactions, but I keep thinking things would have been much simpler if it did.
Take a look at this method for instance.. SessionManager opens a new session per thread. If I didn't store the transaction, it previous would have bee...
Howdy!
We're developing a nowadays-fashionable multi-tenanted SaaS app (shared database, shared schema), and there's one thing I don't like about it:
public class Domain : BusinessObject
{
public virtual long TenantID
{ get; set; }
public virtual string Name
{ get; set; }
}
The TenantID is driving me nuts, as it has ...
I have an object which contains a property that is the result of an SQL statement. How do I add the SQL statement to my nHibernate mapping file?
Example Object:
public class Library{
public int BookCount
{
get;
set;
}
}
Example Mapping File:
<hibernate-mapping>
<class name="Library" table="Libraries"...
Hi all,
I'm trying to link a Communication object I've created that has 2 properties "SuccessRecipientList" and "FailRecipientList" to a Users object, via joining table "Communication_Recipients". I'd like to do this using a discriminator on the joining table instead of creating an actual domain object for it (Using the HasFailed Bit co...
How do I delete an object without fetching it from the db first?
In another ORM, I can do this:
session.Delete<User>(1); // 1 = PK
...
When i am trying to insert into XrefItem table it's also inserting in Work_Load table but WorkKey is going as 0 i am unable to find whats the reason because the WorkInfo in XrefItem object has the WorkKey val...
A colleague recently ran into a problem where he was passing in a single date parameter to a named query. In the query, the parameter was being used twice, once in an expression and once in a GROUP BY clause. Much to our surprise, we discovered that NHibernate used two variables and sent the single named parameter in twice, as @p1 and @p...
I have two tables Boxer and Prospect. Boxers has general stuff like name and and dob etc and a BoxerId
While Prospect contains only one value (at the moment) which is a boxerId.
If a boxer is a prospect(up and coming boxer) there Id will be in the prospect table.
This works fine but now I want to select all boxers that are prospects
...
I am trying to use lazy="extra" for the child collection of Trades I have on my Client object. The trades is an Iset<Trade> Trades, exposed as ReadOnlyCollection<Trade> because I do not want anyone to modify the collection directly. As a result, I have added AddTrade and RemoveTrade methods.
Now I have a Client Search page where I need ...
I have a C# WinForms application with a database backend (oracle) and use NHibernate for O/R mapping. I would like to reduce communication to the database as much as possible since the network in here is quite slow, so I read about second level caching. I found this quite good introduction, which lists the following available cache imple...
Hi a simple question
Does nHibernate support multiple record-sets returning from an SP, if so can someone show me some basic implementation?
Thanks, Mark
...
I have been trying to implement Nhibernate.Linq 1.0.0.4000 together with Nhibernate 2.1.2.4000. After what I've read that should be a straightforward process - just adding a reference to Nhibernate.Linq and then start querying with Session.Linq<>..
So.. In my repository I added a very simple query:
var query = (from l in _session.Lin...
what event is fired when data loaded using CreateCriteria? i want to modify the data behavior before it is returned by CreateCriteria.
im not lucky to find any documentation about Event system.
i have tried IPostCollectionRecreateEventListener but i found that the OnPostRecreateCollection is never called.
please anyone can provide me a...
Hi,
This is probably a very simple question but I'm new to nHibernate and I'm having trouble working this out.
I have a Page object, which can have many Region objects. I also have a Workflow object. Page and Region objects both have a relationship to Workflow and it's this double association that I'm having trouble with.
The PageMap...
Hi.
I'm trying to define a property that is not the id as a clustered index in nhibernate, yet I've found no way of doing this.
Could anyone give me a pointer of how this is done, or it is something not currently available in nhibernate?
Thanks in advance
...