Hi everyone:
I wrote an test case extending the Spring.Net's AbstractTransactionalDbProviderSpringContextTests class and trying to do something like this.
Step.1 MyHibernateDao.Find(id)
Step.2 Use SqlConnection API to insert some record into database.
Either step.1 or step.2 can run successfully, but if I put them together, step.2 wi...
I have the following entities:
namespace NhLists {
public class Lesson {
public virtual int Id { get; set; }
public virtual string Title { get; set; }
}
public class Module {
public virtual int Id { get; set; }
public virtual IList<Lesson> Lessons { get; set; }
public Module() {
Lessons = new List<Lesson>...
I'm stumped. I have a client site on a virtual private server - Windows Web Server 2008 SP2, IIS7, SQL Server 2008 Express.
I'm trying to setup a second web application, to allow him to review updates prior to their going live. I've created the web application in IIS7, and I have added a second database to SQL Server. The second db i...
I'm working on a project to replace ADO.NET data access logic using NHibernate where we're not able to map the entire domain model at once. This means we'll have domain classes with property mappings to other domain classes that aren't yet mapped with NHibernate.
Consider a Person class with an Address property (Address being a domain ...
The Example class is great if you are specifying which properties you want to exclude from the example. But what if you want to specify which properties to include?
Take this example: looking for people in the database that have the same name.
A Person object has many properties. So to use the NHibernate.Criterion.Example object I would...
I am looking for a way to get the entire object graph back from one of my nhibernate persisted entities. Is there a way to turn off lazy loading in a sessionfactory,session or query?
I have tried setting the FetchMode but it does not eagerly load the entity and child collections.
I just need this for one object to export it out of the...
We're (slowly) moving an application (with a classic ADO.NET DAL) to NHibernate (following both "one-session-per-request pattern" and "repository pattern").
The application, right now, is in a hybrid state (I know, it's horrorful):
some query are made by disposable DAO objects (that open a connection in their constructors and dispose ...
I'm currently in the middle of a reasonably large question / answer based application (kind of like stackoverflow / answerbag.com)
We're using SQL (Azure) and nHibernate for data access and MVC for the UI app.
So far, the schema is roughly along the lines of the stackoverflow db in the sense that we have a single Post table (contains bo...
How can I map following queries using Fluent NHibernate (entity, mapping class etc..), the employee ids are stored in identifier tables. Person table contains employee information and non-employee information.
SELECT p.Id, p.FirstName, p.LastName
FROM Person p
UNION ALL
SELECT e.Id, e.FirstName, e.LastName
FROM Employee e
...
I'm using System.Data.SQLite with NHibernate & Fluent NHibernate.
I encountered some strange bug and I would like to log all queries executed on the SQLite database.
I already know about the ShowSQL NHibernate configuration option but I would like to log directly from SQLite. I found out about sqlite3_trace() but how to use it from .Ne...
Hi,
I need to setup session management in MVC. what is the correct way of doing so?
How to setup nhibernate session management in mvc using structuremap so I don't get:
Session is closed
or
Using a single Session in multiple threads is likely a bug.
My current configuration is:
in GlobalAssax:
protected void Application_Start()
{
...
I looking for some information on how to build an ASP.NET MVC application using nHibernate and n-tier layers.
Can I have example please.
...
What is spring? Why is it being usd with Hibernate? Whats its utility?
...
I'm going to refactor a growing project from using Castle Activerecord to pure NHibernate or Fluent NHibernate with Service/Repository pattern and POCO.
What would be an easiest way to obtain hbm xml from existing Castle Activerecord model?
Another question, is it possible to convert hbm to Fluent NH and vice versa?
...
I have a SQL query I'm having trouble creating using NHibernate Criteria:
SELECT ID, COLA, COLB, COLC
FROM table
WHERE COLC='something' AND ID IN (SELECT ID FROM (SELECT MAX(ID) as ID, COLA FROM table WHERE COLB='something' GROUP BY COLA) subquery)
ORDER BY ID DESC
I originally had this slightly simpler query:
SELECT ID, COLA, COLB, ...
I am trying to use a custom collection on a business object via a collection factory class that implements IUserCollectionType. The relevant methods on this class are implemented like so:
public object Instantiate(int anticipatedSize)
{
return new MyCustomCollection<T>()
}
public IPersistentCollection Instantia...
I have a console app that exports my entity models to my sql db and I am able to export that schema to an .sql file without issue. However, my DBA's want .sql files for all the initial data that should be populated in the db as well. My console app uses NHibernate to save a bunch of objects to the database right after it creates the data...
Is it possible to map the following situation?
A product class (currently a table)
An account class (currently a table)
An accountproduct class (currently a join table but with additional information related to a specific product and account)
What I'd ideally like is accountproduct to extend product and to be available from account a...
Hello,
I've been trying to get distinct values using Linq to NHibernate and I'm failing miserably.
I've tried:
var query = from requesters in _session.Linq<Requesters>()
orderby requesters.Requestor ascending
select requesters;
return query.Distinct();
As well as
var query = from requesters in _session.Linq<Reques...
I am having an issue with saving entities with one-to-one relationships. I just want to save the parent entity and have the child be save aswell but I am having to save both separately.
This is an example of what I am having to do, otherwise the child is not saved.
var session = SessionProvider.OpenSession.Session;
using (...