I am using sql server 2005
but having error message on
_sessionFactory = configuration.BuildSessionFactory();
What is wrong and how can I correct it?
My Hibernate.cfg.xml
<property name="connection.driver_class">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.MsSql200...
According to NHProf, the use of implicit transactions is discouraged:
http://nhprof.com/Learn/Alerts/DoNotUseImplicitTransactions
However, NHibernate LINQ returns an IQueryable<> when reading objects from the database, and this is lazily evaluated. I have this method in a repository:
public IQueryable<T> GetAll<T>()
{
using (var t...
I'm using Fluent NHibernate's automapper to map the following domain model (via AutoMap.AssemblyOf<Ticket>()), but it's throwing an exception when creating a SessionFactory.
class Ticket {
Owner TicketOwner { get; set; }
Owner CreatedBy { get; set; }
}
abstract class Owner {
ICollection<Ticket> OwnedTickets { get; set; }
...
Lately I've been looking into the .NET based ORMs that are available. I've noticed that each ends up siting in one or two camps. In one camp the database is created first, and the ORM provides an easier way to access the database in an application. In the second camp the object model exists first and the ORM facilitates persisting the ob...
I see that Session.Find(string query, object[] values, IType[] types) is obsolete, and the suggestion is to use CreateQuery().SetParameterList().List() instead.
So if I already have code that looks like this:
var query = "from TABLE t where t.COL1 = ? and t.COL2 = ?";
var vals = new[] { qc1, qc2 };
var types = new[] { ScalarType.String...
I'm building a new site from scratch and am considering using Fluent NHibernate for my ORM. I think it'll handle everything easily except, possibly, my XML columns. I've never built a site with NHibernate at all (though I've used Hibernate for Java) so consider me a n00b.
Ideally I'd like the XML to be treated as an XElement as Linq-to-...
Let's say I have an entity like so:
public class Product
{
public virtual int Id { get; set; }
public virtual int Name { get; set; }
}
A client wants to update the name of a particular product, so he sends this JSON back to an ASP.NET server:
{
"Id": 1,
"Name": "Updated Product Name"
}
I then run this code to try an...
I'm writing an application where users can create one or more "Catalogs" which are stored in a database. However, I want to allow for multiple database formats (SQL Server and SQL Lite), and I want a user to be able to have multiple catalogs opened in the application simultaneously. The location of the catalog databases will not be know...
I'm new to NHibernate, and am trying to map a domain model that has a bit of inheritence etc (see this question for full details on my model, starting a new question as this is a different error)
My base class has some abstract methods that each class beneath has to implement. This appears to be causing problems with NHibernate, even th...
In NHibernate manual I have found mapping like this:
<bag name="Sizes" table="SIZES" order-by="SIZE ASC">
<key column="OWNER"/>
<element column="SIZE" type="Int32"/>
</bag>
I can't help wondering why would anyone want to do something like this? Is there something better about mapping plain integers than creating an entity corr...
I've got following query
DetachedCriteria criteria = DetachedCriteria.For(typeof(Income))
.CreateAlias("Product", "p")
.SetProjection(
Projections.ProjectionList()
.Add(Projections.GroupProperty("Product"))
.Add(Projections.Sum("Quantity"...
Hi,
I have following problem:
We have multi-value fields in DB like ProductLineIdList which stores every allowed productLines separated by comma (for example "2,13,27,33"). I would like to map this field to IList (list with 4 entities). Is it possible to do that? Thx
...
Is Castle Windsor's Inteceptor mechanism considered to be a good/effective way of implementing the Unit of Work pattern?
My project involves Castle Windsor, the NHibernate Facility and of course NHibernate - all used in self-hosted WCF services.
Each service method normally requests from the Windsor container an instance of a helper cl...
Hi all,
I'm using NHibernate 2.1.2.4000GA. I'm trying to use SQL Server's CONTAINS function from within HQL and the criteria APIs. This works fine in HQL:
CONTAINS(:value)
However, I need to qualify the table in question. This works fine:
CONTAINS(table.Column, :value)
However, I need to search across all indexed columns in my tab...
I am having the following in my .hbm.xml file
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="Core.Domain.Model"
assembly="Core">
<class name="Category" table="Categories" dynamic-update="true">
<cache ...
What is the difference between using
using (var scope = new TransactionScope(TransactionScopeOption.Required))
{
using (ISession session = NHibernateHelper.OpenSession())
{
using (ITransaction transaction = session.BeginTransaction())
{
session.Delete(entity);
...
We are running webservices which get called to populate and update our database, in one of the functions an EntityReactionType get's filled by the caller of the webservice with the ID's.
EntityReactionType has a composite many-to-one key consisting of Entity and (suprise) ReactionType.
These ID's get filled with the right values and i ...
I'm trying to port a large graph of .NET entities to use NHibernate, but I'm encountering an issue that most of the relationships are only defined unidirectionally - in most cases, the child class contains a reference to the parent, but the parent does not contain the collection of refs to its children. It would be quite a bit of work t...
Hi, is there a way to see all open nhibernate session in the application?
Why?
Because, Ia m getting this error in my MVC application:
Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
I have done th...
Hi all,
We use a lot of view model builders which pass HQL strings to the ActiveRecordMediator.Execute method to populate search objects for our views.
Doing refactoring occassionally breaks these 'magic' hql strings (without us knowing)
I was wondering if anyone has tried using nhibernate named queries to validate HQL in Castle Activ...