Assume that I have Person and Address Classes and they have different tables in DB.
One Person can have one Address Class in it. This is the important part for me. One Person can have only one Address as it s child element and i want to keep them in different tables in DB.
Normally i know that i need to hold them in the same table, but...
Hello,
Does anyone know if it is possible to tell if a specific property on an object is dirty (i.e. the property is different to the one stored on the DB) using NHibernate?
The background to this question is that I will have an object with a (relatively) large number of properties on it. I need to be able to pass a parameter (string)...
How can I create generic component mapping in NHibernate, I have a class Pair{virtual T First{get;set}, virtual T Second{get;set;}}, I am trying to map it with something like this which is not working
...
I have a pretty basic NHibernate setup. I am not using Castle Widnsor or anything special like that to do IoC in my code. All I want to do is set my Lifestyle to PerWebRequest, but I cannot figure out how to do this with out going back through my code and updating it to use an IoC library.
Is there any way to do this in the config f...
Hi,
I have posted a question few days ago about Querying on collections with the Criteria API and after all the answers i see that the thing that i am trying is not possible with the Criteria, there is a bug for the situation in nhibernate and also in hibernate
I was using DetachedCriteria to get all criterias together and the list is ...
I need to do paging with the sort order based on a calculation. The calculation is similar to something like reddit's hotness algorithm in that its dependant on time - time since post creation.
I'm wondering what the best practice for this would be. Whether to have this sort as a SQL function, or to run an update once an hour to calcula...
Hello everybody, probably I'm too n00b to understand this, but I was reading the Gabriel Schenker http://nhforge.org/wikis/patternsandpractices/nhibernate-and-the-unit-of-work-pattern.aspx UnitOfWork implementation and I really cannot get the point.
Why does the UnitOfWorkImplementor.Dispose need to forward the dispose to the UnitOfWork...
Hello!
I'm currently trying to move from hand-crafted hql to queries constructed via DetachedCriteria. I have and HQL:
from GenericObject genericObject
left join fetch genericObject.Positions positions
where (positions.Key.TrackedSourceID, positions.Key.PositionTimestamp) in
(select gp.Key.TrackedSourceID, max(gp.Key...
When i use SetFirstResult and SetMaxResult and if the query has joins the result have duplicate results instead of unique.
Then i use all type of Distinct helpers for criteria api. But it doesnt filter the whole result set it just filters the paged result.
How can i overcome this issue ?
Thanks
...
I've been having a brief look at NHibernate and Linq2Sql. I'm also intending to have a peek at Entity Framework.
The question that gets raised, when I talk of these ORM's is "They can't scale", so can they? From Google I get the impression they're able to scale well, but ultimately I suppose there must be a price to pay, Is it worth pay...
I am setting up an n-tier application with MVC, Ninject, and NHibernate (my first using these technologies). For clarity's sake, the tiers are a "Data" tier, a "Services" tier, and a "Web" tier (all are separate projects).
With MVC, you have your models that are in the "Models" folder. It seems necessary to put my models here to create...
Hi,
Just a quick question. If I've got 2 tables that are joined in a 3rd table with a many-to-many relationship, is it possible to write an ICriteria with expressions in one of the tables and the join table?
Lets say the mapping file looks something like:
<bag name ="Bag" table="JoinTable" cascade ="none">
<key column="Data_...
I have a database that uses natural keys (i.e. business oriented keys). Unfortunately, because of this, the primary keys for these objects may change over time.
I am currently researching the use of NHibernate for an O/RM for this database. However, in my testing I have noticed that there is no apparent way to change the primary key of...
I have a query about the Microsoft's Enterprise Library Data Access Application Block and NHibernate.
We are in the designing phase of our Software of Anti Money Laundering.
The Criteria is as below:
We have Customer Class which contains Account Class in One to Many relationship. The model is as follows:
Customer 1->M Accounts
The...
I have the following domain object:
public class Data
{
public virtual int ID { get; set; }
public virtual DateTime TimeStamp { get; set; }
public virtual int Value { get; set; }
public virtual Channel Channel { get; set; }
}
I'm using Repositories from Rhino.Commons. I need to select sum of values for few cha...
Hi,
I am working on a ASP.NET MVC website using Nhibernate as my ORM. The project is similar to a wiki/blog engine and requires that as pages are edited they store a history of the edits in another table which can then be viewed and recovered. This is complicated somewhat in that each "page" can have collections associated with it that ...
I am a little ashamed to say that I have never used an ORM; as you may recall most of my career experience is hacking around with Classic ASP and the little .NET I do tends to be maintenance only.
For my own career as well as in preparation for a new project at work (done in .NET finally!) I'm looking at adding an ORM to my skillset - b...
I'm using Fluent NHibernate and I would like to implement NHibernate.Search with Lucene but I can't find any examples on how to do that with Fluent NHibernate. It appears there are two steps. (According to Castle)
Set the Hibernate properties in the configuration:
hibernate.search.default.directory_provider
hibernate.search.default.i...
Hello,
I'm trying to use NHibernate with an existing database. In the data-model there is columns in each table that contains the time and username of the last update made to a row. How do I do this using NHibernate?
I tried to implement a interceptor that sets ChangeTime and ChangeUser in the entities before it gets saved using the I...
Is there any way in NHibernate that I can use the following Entities
public class Person
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual IList<Pet> Pets { get; set; }
}
public class Pet
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
}
An...