Hi,
I have the following two tables:
Package
id
ClientPackage
id
clientNumber
packageId
The thing is that I do not have a Client table in this database (it resides in another database). Is there a way that I can create a Client mapping to a Client model which just consist of distinct "clientNumber" from the ClientPackage table whil...
I am having some issues when running sp_executesql on a database table. I am using an ORM (NHibernate) that generates a SQL query that queries one table in this case. This table has about 7 million records in it and is highly indexed.
When I run the query that the ORM spits out without the sp_executesql, it runs very quickly and pro...
I am using looking to use a sub query in Nhibernate Criteria to check on the visibility of a row. I have created a subquery in sql that looks like this
select * from Visibility as b
where **ProductID = a.id**
and SiteId in (129)
and ( Hide = 1
and (
((StartDate < GETDATE()) and (EndDate is null))
or
((EndDate > GETDATE()) ...
Hi, guys
I want to store my object in ASP.NET Session. This object has some lazy loaded properties. When I do postback to my page and get my object from Session, this properties throw LazyInitializationException. Can I rebind this object to newly creates Nhibernate Session to retrieve this properties or I have to create Session and get ...
Hello,
we're working on a large windows forms .net application with a very large database. currently we're reaching 400 tables and business objects but thats maybe 1/4 of the whole application.
My question now is, how to handle this large ammount of mapping files with nhibernate with performance and memory usage in mind.
The business ...
I have an entity that represents a Tweet from Twitter like so:
public class Tweet
{
public virtual long Id { get; set; }
public virtual string Username { get; set; }
public virtual string Message { get; set; }
// other properties (snip)...
public virtual ISet<long> VoterIds { get; protected set; }
}
I'm trying to...
I'm starting to develop with Fluent NHiberate, and I was wondering how I create a defined 'Foreign Key' relationship in my Mapping class.
Here's my class. These classes are a one-to-one with associated tables.
public class Song
{
public virtual int SongID{ get; private set; } //Primary Key
public virtual int SongArtistID { get...
I've have started my foray into C#.NET and NHibernate and I'm finally stuck on an exception I can't seem to figure out, and Google isn't helping.
I'm getting a NHibernate.DuplicateMappingException : Duplicate class/entity mapping on my Parent class. Below is my mapping file for the Parent class, and the Youth class that uses the Parent...
I found when i different Database session factory in single transactionscope,
it will failed.
for example:
1) this will work if mutiple session factory points to the same db.
Transacton 1 & Transaction 2 are for the same db.
using (var scope = new TransactionScope())
{
//transaction 1
using (var session = AdPubSessionConfig....
Hi,
I have a class School and another class Teachers. now every school can contain m Teachers and one Teacher may be part of more than one school. But in the Teachers class I dont want a property that tells me which Schools a teacher is part of.
Thus,
public class School
{
public virtual int Id {get;set;}
public virtual string Name {g...
Hi,
Im playing around with NHibernate 3 alpha but struggling to set up my SessionFactory.
I have the following:
var config = new Configuration().Configure();
_sessionFactory = config.BuildSessionFactory();
However, in the provided dlls with the 3 alpha download there are no provided proxy factory classes. Ie NHibernate.ByteCode.Ca...
Currently I'm writing strategies for various purposes.
Like this one:
namespace x.Persistence{
using Domain;
using NHibernate.Linq;
public class ApplicationDefaultEagerLoading
:IEagerLoadingStrategy<Application>{
public virtual INHibernateQueryable<Application>
Attach(INHibernateQueryable<Application> q){
q.E...
I'm working on a 2-tier application where WinForms client makes direct calls to the database. In one of the scenarios I need to display a list of Customer entities to a user. The problem is that Customer entity contains a lot of properties (some quite heavy) and I need only two of them - first and last names. So to improve performance an...
Hi all,
A project I am currently employed with will have some time soon to improve and specialise a product that is currently in use.
We may have about 4 man weeks spare in which we could replace the typed datasets that are in use.
The project is currently written in Vb.Net and we will definitely not have time to replace this code with...
This has been a problem that has existed on 3 projects for me.
I have tried the following:
<property name="connection.isolation">ReadCommitted</property>
Set in hibernate.cfg.xml
Using fluent nhiberate:
MsSqlConfiguration.MsSql2008.IsolationLevel(IsolationLevel.ReadCommitted);
Set in global.asax.cs
I have always been forced to s...
Hi,
I am a newbie to NHibernate. Just was thinking whether we can make use of the Sharp Architecture in a web application, without MVC?
Thanks.
...
Background
We have several projects / applications running off the same model. They all have their own unique entities / tables, but also share 1 specific, common entity / table.
I.e. Entities required by application A, will never be required by application B, except for the common table, and vice versa. Now the common table has relatio...
In the application I'm developing, I am using NHibernate as ORM.
My app has to support SQL Server, and MS Access (I'm using the NHibernate JetDriver).
Now, the thing is that I have a certain query which I cannot achieve using HQL or the ICriteria API; so, I'm using an ISQLQuery for that one.
Now, what bothers me, is that it seems that ...
Is this possible in fluent nhibernate having multiple mappings for one table? Lets suppose i have a Users table.
Once i want it to be apped exactly like in file UserMap1.cs, and some times I would rather prefer mapping from UserMap2.cs.
I don't need to switch configurations while app is running. I just have to choose a proper one at th...
I want to write a nhibernate query to get all employees who are in the given list of departments.
The senario is the employee class has the department class property.the department class has the department name in it besides other properties.I have a list of department names with me and i want all employees who belong to that departm...