I have a many-to-many relationship defined between two entities using an association table and cascade="save-update".
Entity1 contains a list of Entity2, and conversely, Entity2 contains a list of Entity1. The SQL outputted from this worflow seems ok...
Create an Entity1 and Entity2 object
Add Entity2 to the List on Entity1
Call sessi...
I decided to test nhibernate on an existing application (replacing linq to sql) and I'm seeing abysmal results so far. Hopefully someone here can point me in the right direction.
My config:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2...
I've read in this post that all the ProxyFactory dependency was removed by using an interface in this post.
So you need to specify which implementation to use in the hibernate.cfg.xml file.
I've this configuration:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-facto...
I am using Nhibernate 2.1.0 in my project.
I have the an Item class with property Path and the following named query:
<hibernate-mapping xmlns='urn:nhibernate-mapping-2.2'>
<sql-query name='updateUNC'>
<query-param name='oldUNC' type='String'/>
<query-param name='newUNC' type='String'/>
<![CDATA[
update Item s s...
So far, the only successful strategy I've been able to get by with is the following:
Configure YOURAPP.Web to "Use Local IIS Web Server" and set "Project Url" = http://localhost/yourapp.web
Click "Create Virtual Directory"
In IIS Manager ensure that "Classic .NET App Pool" is selected
Add wildcard mapping * named "ASP.NET-MVC" that ...
I have a problem width Polymorphic association in nhibernate.
DocumentLocation Mapping :
<class name="Document.DocumentLocation" table="DocumentLocation">
<id name="DocumentLocationId" type="Int32" unsaved-value="null">
<column name="DocumentLocationId" length="4" sql-type="int" not-null="true" unique="true" index="PK_Documen...
Hi,
I have entity User with one-to-many relationship to UserToUserCategories. When I load user from database, do not change it and than flush the session, NHibernate will performs UPDATE of the user and increment it's version. It seems to me as unwanted behaviour, imagine that I load hundred of users and NHibernate would update them all...
Hi,
Can someone explain this little mystery to me about how NHibernate handles composite elements.
I have classes that look like this;
public class Blog
{
public virtual int Id
{
get;
private set;
}
public virtual ISet<Comment> Comments
{
get;
set;
}
}
public class Comment
{
...
Hi
i have a problem with my first app with NHibernate like ORM
in this example: http://nhforge.org/wikis/howtonh/your-first-nhibernate-based-application.aspx
they use this simple test:
public void Can_generate_schema()
{
var cfg = new Configuration();
cfg.Configure();
cfg.AddAssembly(typeof ...
I have a table in a MySql database with a datetime field. This is mapped to my domain object in an hbm.xml file with a property similar to the following:
<property name="StartDate" column="datStartDate" not-null="true" type="datetime"/>
This all works fine, except MySql doesn't store the millisecond portion of the DateTime field...
I'm investigating optimistic concurrency in NHibernate. I have a scenario that is very similar to what is being described here:
http://weblogs.asp.net/stefansedich/archive/2008/10/01/set-the-value-of-a-version-column-in-nhibernate-manually.aspx
Would you recommend going with the proposed solution in this blog post?
Thanks
...
We are trying to design a site that will support multilingual data and we use asp.net and nhibernate for O/R mapping. After some googling we decided that for us its best to create the entity classes containing all fields we need for supporting the default (english) language and for each multilingual class we would create a new class cont...
We are building a translation application which reads data from one database and translates it into a completely different format. We will be using NHibernate to read from the source database which is not yet available. We want to test the translation core logic by dummying up a source object, pass it through our translation core, and ...
Is it possible to map multiple tables to a single domain model using NHibernate? It's basically a UNION, something like shown below but I am not sure how to do the domain models in C# and mappings of NHibernate.
I basically have 1 abstract class and 2 concrete classes. Each concrete class can be mapped to a single table in the databse....
I am assuming nhibernate can handle circular reference issues as I have not seen this mentioned otherwise in the docs or on google (but perhaps I have the wrong terms).
Suppose I have a class which has as a member a reference to an instance of itself:
e.g.
class A
{
A Other;
}
I then create 2 objects and have them cross reference o...
We use NHibernate Criteria for complex search query. In multiple places we need to use Expression.Sql.
Sample (not working, just sample) code:
//Parent entity - Parent table in database
public class Parent
{
public int ID
{
get;set;
}
public string ParentName
{
get;set;
}
}
//Child entity - one-to-one lin...
Assuming the following:
public class Order
{
public virtual int OrderId {get;set}
public virtual ISet<Product> Products {get;set}
}
public class Product
{
public virtual int ProductId {get;set}
public virtual string ProductName {get;set}
}
How would you query using the criteria api so that only an order with a specific o...
Hi all,
I need to map two different classes to the same view and receive an error that a duplicate mapping exists. Is this possible in NHibernate? If not, can anyone give direction as to how I can solve this mapping problem.
I work with views which are set in stone. One view brings back data needed to split into two classes. The view lo...
Hi,
I've been developing a webapp using Linq to NHibernate for the past few months, but haven't profiled the SQL it generates until now. Using NH Profiler, it now seems that the following chunk of code hits the DB more than 3,000 times when the Linq expression is executed.
var activeCaseList = from c in UserRepository.GetCases...
Is there any way to use expressions in the Select clause?
E.g.:
select u.Age/2
from User u
I'm having this exception right now:
NHibernate.QueryException: ',' expected in SELECT before:/ [select u.Age/2 from Business.Entities.User u]
...