Hi all.
I've spent some time searching around how to configure NHibernate's FlushMode so it could only save objects that I've explicity called Save/Update/Delete, but I've figured out that I can't do that. Instead of it, I have to evict every object that I've modified (even without calling Save/Update/Delete) as I'm using NHibernate tra...
I have an existing view which has too much data in it. Unfortunately I cannot get rid of it so I need to try to work around it using my NHibernate mapping. The idea is to have NH issue the following query:
SELECT DISTINCT User_Id, Module_Id, Application_Id, RightsMask
FROM V_UserApplicationPermissions
WHERE User_Id = ?
My current ma...
Hi!
I'm having difficulties with multiple joins in the NHibernate Criteria search. Say I had a pet table, and I wanted to return all pets where the pet category was Dog, and the owner gender was female, ordered by the pet birthday. I've tried a bunch of permutations for how I can get this but haven't been able to figure it out. My la...
I am trying to figure out what I thought was just a simple one to many mapping using fluent Nhibernate. I hoping someone can point me to the right directory to achieve this one to many relations
I have an articles table and a categories table
Many Articles can only belong to one Category
Now my Categores table has 4 Categories and Articl...
How do you limit the result set of a mapped collection in nHibernate? For instance:
Model.Items;
will always return all the Items for the given Model. Is there any way to force it to return only, say, 20 Items without creating a specific query ? Something like
Model.Items.SetMaxResults(20);
In other words, I would like nHibernate...
Consider I have a parent, child relationship class and mapping. I am using NHibernate to read the object from the database, and intended to use WCF to send the object across the wire.
Goal
For reading the parent object, I want to selectively, at different execution path, decide when I would want to load the child object. Because I don...
I'm creating a simple Windows Forms application with NHibernate and I'm a bit confused about how I'm supposed to use it. To quote the manual:
ISession (NHibernate.ISession)
A single-threaded, short-lived object representing a conversation between the application and the persistent store. Wraps an ADO.NET connection. Factory for ...
I'm having a problem in mapping an existing data class member to the database..
I have a database table where one of the columns is a string type, but actually stores a comma separated list of numbers. My data class shows this field as a list of integers.
The problem is that I couldn't find any hook in NHibernate that allows me to invo...
I have been reading about Command Query Responsibility Segregation (CQRS). I sort of wonder how would this work with ASP.NET MVC? I get the idea of CQRS conceptually it sounds nice and sure does introduce some complexities (event and messaging pattern) compared to the "normal/common" approach . Also the idea of CQRS sort of against the u...
I have a question for a specific many-to-any mapping problem:
I'd like to have a fluent mapping for this simplified domain (non relevant properties removed)
public interface IModule
{
Container Container { get; }
}
//This is mapped to [dbo].Container table in the database
public class Container: Entity
{
// ...
// I need to...
I have no control over database schema and have the following (simplified) table structure:
CityProfile
Id
Name
CountryProfile
Id
Name
RegionProfile
Id
Name
I have a .Net enum and class encapsulating the lot:
public enum Scope { Region, Country, City }
public class Profile {
public Scope Scope { get; set; }
public int...
Im trying to return a SimpleQuery list that queries a single table and uses IN.
I can get this to work using
return new List<Jobs>(
ActiveRecordMediator<Jobs>.FindAll(Expression.In("ServiceId", ids))
);
However this is really really really slow. So id like to do something like this
SimpleQuery<Job> query =
new SimpleQuery<Jo...
We are using nHibernate 1.2 in a system which is not performing good. Will there be some performance improvement if we migrate to latest version of nHibernate?
Overall is it a good idea to migrate to the latest version of nHibernate?
EDIT: I want to use following features to improve performance.
1. Second level cache.
2. Joined Tab...
Hi Folks
I am trying to create an nHibernate mapping for a class structure like so:
class UserDetails{
Guid id;
User user;
Role role;
public User UserInfo{
get;set;
}
public Role UserRoles{
get;set;
}
public Guid ID{
Get; set;
}
}
class User{
string name;
int id...
What is the best way to do entity-based validation (each entity class has an IsValid() method that validates its internal members) in ASP.NET MVC, with a "session-per-request" model, where the controller has zero (or limited) knowledge of the ISession? Here's the pattern I'm using:
Get an entity by ID, using an IFooRepository that wrap...
I am using NHibernate to persist information in my media player app. Basically at the minute I have a mapping setup for the Track class and for the Playlist class:
Track Playlist
====== =========
Id Id
Name Name
FilePath
etc...
This is working fine...
We are getting this error after upgrading to NHibernate 2.1.
[QueryException: Cannot simultaneously fetch multiple bags.]
NHibernate.Loader.BasicLoader.PostInstantiate() +418
NHibernate.Loader.Entity.EntityLoader..ctor(IOuterJoinLoadable persister, String[] uniqueKey, IType uniqueKeyType, Int32 batchSize, LockMode lockMode, ISessi...
I have a class which I want to add a property with using formula attribute.
Here is the mapping that I use in mapping file.
<property name="CurrentUserVote" type="Climate.Domain.Vote, Climate.Domain" formula="(select v from Vote v where v.AchievementId=Id and (v.IP=:CurrentUserVoteFilter.CurrentUserIP))"></property>
As you see, I wa...
I am developing an MVC application using nHibernate; running through VS's built in web server the application runs without errors. When setup and running through IIS7 on localhost, the application throws a SQlClientPermission exception after calling System.Data.SqlClient.PermissionDemand (SqlClient calls this internally)
I have enabled...
Is it possible to perform a global reversed-find on NHibernate-managed objects?
Specifically, I have a persistent class called "Io". There are a huge number of fields across multiple tables which can potentially contain an object of that type. Is there a way (given a specific instance of an Io object), to retrieve a list of objects (o...