I am trying to connect to an Oracle Database using nHibernate. I can connect using the .Net driver:
<property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property>
However I would prefer to use the OracleDataClientDriver that ships with Oracle (or nHibernate? I forget). Anyway I was using the instructions ...
I have to import data from a Lotus Notes database via ODBC. The source data are all varchar fields while some columns actually contain dates and numbers. I mapped those colums with NHibernate to the appropriate types which works for loading but not for comparing (using criteria, e.g. Restrictions.Eq("StoreId", 123)).
Whenever I execute ...
NHibernate.Context.WebSessionContext, otherwise known as web session context, plays nicely with ASP.NET, but only up to a point. As soon as I spin up a new thread, it is no longer able to retrieve current session from a HttpContext since there's actually no HttpContext for the said thread.
How do you make all this play nicely together?
...
First, some background: I'm new to ASP.NET MVC 2 and NHibernate. I'm starting my first application and I want to use NHibernate, because I come from JSP + Struts 1 + Hibernate web applications.
No one seems to be talking about this, so I guess it must be pretty obvious. Still I scratch my head because I can't find a solution that accomp...
Let's say I have a Cat that has two properties:
FavoriteKitten
SecondFavoriteKitten
These kittens are discriminated by their Rank.
When loading a Cat, I want the kitten with the rank of "1" to be
FavoriteKitten, and the kitten with the rank of "2" to be
SecondFavoriteKitten.
The underlying database looks like:
table Cat
----------...
I have an object model that I want to store using an embedded database. I have so far been looking at db4o, NHibernate to SQLCE (w/ linq), and RavenDB. This would be used in a desktop C# application.
The key features I am looking to leverage are: Linq or similar for queries (no SQL or HQL), Embedded data engine, pocos, poco first model,...
hi, how can i achieve this query with Nhibernate Linq?
var l = session.CreateQuery("from Auswahl a where a.Returnkey is not null").List<Auswahl>();
i tried this but it always returns an empty list.
var l = session.Linq<Auswahl>()
.Where(item => !String.IsNullOrEmpty(item.Returnkey))
.Select(item ...
I would like to get correct Exception from ADO.NET about foreign key violation. Is there a way to do that?
I am using try to catch ADO.Exception and check it message text for 'foreign'. So, if there is 'foreign' text in exception text, it is a violation and I can alert.
Is it the right way to do or any other method?
try{
base.De...
Hi
How would I do what Scott has done in one call using nHibernate 2 ObjectDataSource
http://weblogs.asp.net/scottgu/archive/2006/01/07/434787.aspx
below is my Data access method
public IList GetListOfUser(int rows, int pageIndex) {
IList userList = null;
using (ITransaction tx = _session.BeginTransaction(...
Hi, i'm trying to remove an item from a one to many list and have it persist in the database. Here are the entities i have defined:
public class SpecialOffer
{
public virtual int SpecialOfferID { get; set; }
public virtual string Title { get; set; }
public virtual IList<SpecialOfferType> Types { get; private set; }
pub...
I am using nHibernate with Oracle, using Oracle's ODP implementation.
http://tiredblogger.wordpress.com/2008/11/07/using-oracle-odp-with-nhibernate-from-a-c-class-library/
This is pretty much working but then I got this error:
Unable to cast object of type 'Oracle.DataAccess.Client.OracleConnection' to type 'System.Data.Common.DbCon...
I have a stored procedure which uses a couple of tables and creates a cross-tab result set. For creating the cross-tab result set I am using CASE statements which are dynamically generated on basis of records in a table.
Is it possible to generate an entity from this SP using ADO.NET Entity framework? Cuz each time I try Get Column Info...
Hi,
I want to use NHibernate with Asp.net 3.5 but i don't know how to use it.I search on
Google but couldn't find the complete explanation about why to use NHibernate,Advantages of using it and integration with Asp.net projects.Please Help me.
...
I have been writing a WPF DESKTOP application using NHibernate, WPF, Prism and Unity Container but have a problem in terms of Session Management in Services / Repositories and how to do it cleanly through dependency injection using Unity.
Having read Building A Desktop To Do-Application With NHibernate I now have a Session Per ViewModel...
I'm working with some code that generates ICriteria queries for NHibernate. They get executed using ActiveRecord and ActiveRecordMediator.FindAll()
For certain queries, I need to optimise them by adding on an OPTION (HASH JOIN) hint at the end of the SELECT statement. Is there a quick way I can do this?
I don't want to rewrite the qu...
Okay, I have a class, Company
public class Company
{
public virtual int Id { get; set; }
public virtual IList<Role> Roles { get; set; }
}
And another class, Role
public class Role
{
public virtual int Id { get; set; }
public virtual Company Company { get; set; }
public virtual RoleLevel RoleLevel { get; set; }
}
...
Is there a way from preventing SchemaExport from generating a foreign key constraint on
mapping type? I saw a similar question about mapping, but unfortunately that wont do for . I couldn't find answer to this in NHibernate reference, but maybe someone knows a trick? I'd like to avoid removing constraint afterwards.
...
Hi,
I'm using Sharp Architecture for an MVC application and I'm trying to generate a nhibernate criterion query for the following SQL:
select top 10 p.* from Tab1 p
join Tab2 v on p.Id = v.Tab1Fk
join Tab3 sbu on v.Id = sbu.Tab2Fk
where sbu.DateTime >= 12/12/2002 00:00:00
...
Is this really all that I have to do to achieve session per request with Ninject?
public class WebModule : NinjectModule
{
public override void Load()
{
Bind<ISession>().ToMethod(x => MvcApplication.SessionFactory.OpenSession()).InRequestScope();
}
}
Global.asax:
public class MvcApplication...
Scenario: I have a customer object with lazy loading enabled. I use that throughout the program to call a list of customer for a listbox. It has relationships to the Division_Customer_Rel, Division_Email_Rel and Email_Address objects. All off the relationships have Lazy = true, Cascade = ManyRelationCascadeEnum.AllDeleteOrphan, Inverse =...