This is something that has been pulling at me for a while. Consider a (MVC type) web application with an ORM (e.g. Nhiberate) as the data access layer.
On one hand - the OOP/Rich domain model hand - I feel I should be passing around (references to) the real objects I am talking about.
On the other hand - the DB/Web App hand - I feel ...
I hope someone can help with this please.
I am trying to query an OLAP Fact table with NHibernate, but am struggling to get it to work. Its seems a simple requirement but I just cant see what the problem could be.
I have a central Fact table with several Dimension tables, one of the Dimensions has a secondary Dimension.
So ERD is. Fa...
One of the many reason to use FluentNHibernate, the new QueryOver API, and the new Linq provider are all because they eliminate "magic string," or strings representing properties or other things that could be represented at compile time.
Sadly, I am using the spatial extensions for NHibernate which haven't been upgraded to support Query...
Hello everyone.
Let me describe the context first:
In a .NET C# project, I use NHibernate to make the link between the C# objects and the database model. I have mapped my objects with NHibernate Mapping Attibutes.
I have written data access queries in HQL, all of them being isolated in individual methods, which are decorated with attr...
I'm using NHibernate as my ORM and I'm trying to sort some data. The data needs to be retrieved paged.
Two of the columns in my Request table are UrgencyID and CreateDate. UrgencyID is a FK to the Urgency table with static data:
1 = Low, 2 = Normal, 3 = High, 4 = Critical.
I need to order my Requests in the following manner.
Critica...
I have a problem with mapping in nhibernate. I am using nhibernate 2.2 version.
Seems like the problem is in mapping but I am not sure this is the cause. Anyway, I have two tables which I would like to map. I created a hbm file for first table and a data transfer object too. All columns were mapped and everything works fine here.
But,...
Because there is so little information about VB.Net and (Fluent) NHibernate to be found, I decided to write this question to all other developers finding themselves looking for more information.
On of the things i had to struggle with was how to Ignore properties in NHibernate.
The reason i had to ignore properties was because we used ...
I have a query that should return 72 unique records based on the userid field. The problem is that what I am getting is 72 copies of the first record.
Here is the query:
return Session
.CreateCriteria()
.Add(Restrictions.Eq("UserId", id))
.List();
and here is ...
I have an application using NHibernate that is already deployed and working properly, and I'm re-factoring the unit tests to use SQLite for improved performance, and to keep unit test data out of the "real" database.
I have a simple test that creates an Calendar entity, saves it, then tries to read it back and verifies that it's the sam...
Possible Duplicate:
Why do I get error: must be a reference type in my C# generic method?
I have 2 Repository methods that are almost identical:
public IList<Fund> GetFundsByName(int pageSize, string searchExpression)
{
return _session.CreateCriteria<Fund>()
.AddNameSearchCriteria<Fund>(searchExpression)
...
I'm developing a question/answer based application
I have a Post table in the db along the lines of:
ID
Title
Body
DateCreated
AuthorID
AuthorName (in case user not registered)
AutherEmail (as above)
PostType (enum - 1 if question, 2 if reply)
Show (bit field)
Then, there is "PostBase" - which is an abstract class (this has pro...
Hello,
I added some calculated read-only properties to my class and it's now throwing a QueryException: could not resolve property.
Here is my class (fake calculations right now):
public class IncompleteApplication : DealerBase
{
public virtual string Content { get; set; }
public virtual string LegalBusinessName
...
So I'm a couple of weeks into NHibernate so pleae bear with me. I am working on a legacy database with lots of weird issues.
I have a name object
public class Name {
public Name()
{
Addresses = new List<Address>();
}
public virtual string Id { get; set; }
public virtual str...
I have a linq query
var query = from record in session.Query<Record>()
from brwSet in session.Query<BorrowerSet>()
from brw in session.Query<Borrower>()
where
brw.PrintOrder == 1 && brwSet.PrintOrder == 0
...
Hi,
I am bit new to NHibernate, and I have this question regarding the performance.
Say we have two tables, A and B, mapped to classes A and B respectively.
class A {
int IdA;
//...
}
class B {
int IdB;
public A MyA;
//...
}
First I load a List<A> from DB, and then load a List<B>. When loading List<B> does it query...
I have an NHibernate mapping problem that does not seem easy to solve, to me.
Names Table
Id (native, primary key) (int)
entity_type (var char) (designates related table)
entity_id (int) (foreign key (kinda) to various tables, based on entity_type)
first_name
last_name
other columns
People Table
Id (native, primary key) (int)
birt...
I'm testing Fluent NHibernate with NorthWind database. Now, I've created Employee and EmployeeMap class. Source code is like below.
class Employee
public class Employee
{
public virtual int EmployeeID { get; private set; }
public virtual string LastName { get; set; }
public virtual string FirstName { get; set; }
public ...
The hibernate manual says this:
String sql = "SELECT ID as {c.id}, NAME as {c.name}, " +
"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} " +
"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID";
List loggedCats = sess.createSQLQuery(sql)
.addEntity("cat", Cat.class)
.addEntity("mother", Cat.class).l...
Hi,
I have a table which saves links to documents. The columns are like this:
link_id # table_name # table_id # link
The table_name column contains a reference to an other table and the table_id contains a reference to the PK of the other table.
This means, I have several tables which use this table to save links in a 1:n manner.
In...
I have 3 methods that are almost exactly identical:
protected DetachedCriteria GetAvailableFundIdsPerDataUniverse()
{
return GetAvailableIdsPerDataUniverse()
.SetProjection(LambdaProjection.Property<Fund>(f => f.Id));
}
protected DetachedCriteria GetAvailableCompanyIdsPerDataUniverse()
{
return GetAvailableIdsPerDataUni...