I am using LINQ to SQL for my data retrieval. One common fetching scenario is to or fetch by some criteria. The code is below.
public EmployeeRegistrationView FetchByEmailID(IDictionary<string, string> criteria)
{
var selEmployeeRegistrationView = from P in db.EmployeeRegistrationViews
...
Hi,
I am using ASP.NET MVC2 with NHibernate, but am facing an issue. All calls to the database via NHibernate should be inside a transaction, however code inside the view kicks off database calls in some instances. Thus there is a need to be able to commit the transaction after the view has rendered.
For example displaying a list of us...
I'm investigating technologies with which to develop a medium-scale (up to 100 or 200 simultaneous users) database-driven web application, and someone suggested Morfik. However, outside of the Morfik company I can find practically zero community support - no active blogs, no tutorials, no videos, no books - and this is of some concern (e...
I'm trying to send objects retrieved by NHibernate over WCF, but whenever a have a property of ICollection I get an exception.
When NHibernate gets the data from the database this property is intitialized with an instance of PersistentGenericSet.
Is there a way I can send a PersistentGenericSet over WCF?
-or-
Is there some way makin...
Within our unit tests we use plain ADO.NET (DataTable, DataAdapter) for preparing the database resp. checking the results, while the tested components themselves run under NHibernate 2.1. .NET version is 3.5, SqlServer version is 2005.
The database tables have identity columns as primary keys. Some tables apply instead-of-insert/update ...
Hi,
I have a class:
public class User
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual IDictionary<string, string> Attributes { get; set; }
}
and a mapping file:
<class name="User" table="Users">
<id name="Id">
<generator class="hilo"/>
</id>
<property name=...
I have a web service that uses nhibernate, calls to the web service go to a simple method that opens the session, begins a transaction and then calls code I don't control that sometimes modifies entities, after that code returns the transaction is commited.
I need to add some extra processing inside the transaction that only happens if ...
Hi Friends,
I got following error whenever anything in project is going to be updated. I am unable to understand what this error message trying to tell. can any body help me in to this.
Server Error in '/' Application.
Unexpected end of file has occurred. The following elements are not closed: hibernate-configuration. Line 1, position ...
I have the following class
public class Person
{
private IList<Person> _children;
public IEnumerable<Person> Children { get; }
public void AddChild(Person child)
{
// Some business logic and adding to the internal list
}
}
What changes would I have to make for NHibenrate to be able to persist the Child co...
Hi,
I am getting the folloinwg error from NHibernate:
System.ObjectDisposedException: Session is closed! Object name: 'ISession'.
at NHibernate.Impl.AbstractSessionImpl.ErrorIfClosed()
at NHibernate.Impl.AbstractSessionImpl.CheckAndUpdateSessionStatus()
at NHibernate.Impl.SessionImpl.FireSave(SaveOrUpdateEvent event)
at NH...
my issue lokks similar to this one: (link)
but i have one-to-many association:
<set name="Fields" cascade="all-delete-orphan" lazy="false" inverse="true">
<key column="[TEMPLATE_ID]"></key>
<one-to-many class="MyNamespace.Field, MyLibrary"/>
</set>
(i also tried to use )
this mapping is for Template object. this one and the Field...
I'm fairly new to nhibernate and fluent nhibernate, I have an issue with associating a collection to a query. In the database I have a well and have 4 associated AFEs. The problem I'm having is that the collection of AFEs is not populating correctly. No matter what I do, I get 4 AFEs in the collection but they are all the same object....
Could you explain, what happens behind the scene?
Transaction management when using this template in Spring is absolutely unclear.
What if I invoke 10 DAO methods that all use the same Hibernatetemplate
and I invoke them one after another? Every method runs within its own transaction?
It's not effective is not it?
...
I am trying to integrate NHibernate into an existing application with several hundred tables. Due to the fact that there apparently wasn't a strict adherence to conventions, I am unable to use Automap. As a result, I'm going to use Fluent to manually map over all of the associations.
Rather than doing it by hand, I'm hoping that there i...
My User table I want to map to aspnet_Users:
<class name="User" table="`User`">
<id name="ID" column="ID" type="Int32" unsaved-value="0">
<generator class="native" />
</id>
<property name="UserId" column="UserId" type="Guid" not-null="true" />
<property name="FullName" column="FullName" type="String" not-null="t...
Hi,
I am trying to put together an index using terms, which I specify as a comma separated list. I want to replicate the display in Luke as seen here:
http://ayende.com/Blog/archive/2009/05/03/nhibernate-search-again.aspx
But my index value just shows as a single field with the comma separate list value. For example:
Tags term,ano...
I'm trying to understand how to configure Fluent NHibernate to enable 2nd-level caching for queries, entities, etc... And at the same time use automapping. There is very little information online on how to do that. Sure it can be done when mapping the classes one by one... But how about automapping?
Here is my configuration code so far:...
Hi.
There is a problem that bother me for some time.
I have an asp.net mvc that uses NHibernate for modeling the database. The infrastructure is the following:
Windows 2008 R2 for all virtual machines.
IIS 7.5 is working on one virtual machine.
Sql Server 2008 is working on another virtual machine. We have couple of databases, two that s...
Hi,
Is it possible to use HQL/ICritera to produce a query with the same semantics as the following SQL query:
select table1.A, table2.B, count(*) from table1
left join (select table2.parent_id, table2.B from table2 where table2.C = 'Some value') as table2
on table2.parent_id = table1.id
group by table1.A, table2.B
order by table1.A
...
How can I write the below HQL query using the Criteria API?
select s.Name, sum(q.PointsObtained), sum(q.TotalPoints)
from Student s join s.Quizzes q
group by s.Name
order by (sum(q.PointsObtained) / sum(q.TotalPoints)) desc
...