Is it possible to embed the hibernate mapping hbm.xml’s to the jar and avoid manual reference in applicationContext.xml like
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernatePr...
I would like to write the following SQl in NHibernate - Detached Criteria if possible.
select * from parent
INNER JOIN child on parent.id=child.parentid
INNER JOIN
(select ChildID, MAX(ChildDate) MaxChildDate from child group by ChildID) max
ON child.childid, child.ChildDate=max.MaxChildDate
This gives me the latest child in ever...
I have a many-to-many relationship with surrogate key
The classes are: Insurer - InsurerSection - Section.
InsurerSection has one extra attribute: active : bool.
How do I access these bool property? Is it possible to have this property contained within the Insurer and Section objects or do I have to call something like:
InsurerSect...
I have 2 entities:
Article
Category
I created the mappings so both entities have each others as collections, so:
Article.Categories
Category.Articles
Now, I want to create a method in either ArticleDAO or CategoryDAO to return a paged (subset) of articles.
Which DAO makes sense?
Since the article entity has categories as its collec...
Hello, I am just learning NHibernate. I have been using examples from the documentation and here at stackoverflow, but I must be missing something.
I have a PARENT object that has a collection of CHILD. A CHILD is meaningless without a PARENT, so the database has FK set to NOT NULL. Implementing NHibernate from CHILD to PARENT works f...
Stumped on this one. I have a many to many self referencing relationship(FluentNH) mapped for a given class:
public class Folder
{
public IList<Folder> ParentFolders{get;set;}
}
I'm looking to create a query that pulls root folders(ie folders that have ParentFolders.Count() == 0). The self reference is done via lookup table, so Pa...
Which .NET JSON serializers can deal with NHibernate proxy objects? I tried using JSON.NET but it craps out when it hits a proxied object.
...
I'm trying to create a Criteria query to select objects that are related via an association table.
Insurer * - 1 Insurer_Section 1 - * Section
InsurerSection has an association attribute: active:bool.
How do I get all Insurers whose active attribute in the InsurerSection class is set to true?
PS: I can't go like this:
Insurer.FindA...
I am running into similar situation as this post. My pseudo code is
string hql = "select ai from AreaInfo as ai where ai.PhoneSegment is substring of :InputPhoneNumber";
Using like wouldn't do the trick because what Like is doing is
string hql = "select ai from AreaInfo as ai where :InputPhoneNumber is substring of ai.PhoneSegment"...
I have a SQL Server 2008 database with a composite key: ProjectID (GUID) and TaskID (int). ProjectID is a foreign key to a Projects table. I want to have TaskID Auto-Increment, but restart for every ProjectID (that is: every projectID should have 1,2,3,... as TaskID).
To my knowledge, this is not possible in SQL Server out of the box, a...
I have two entities, C and P.
C is mapped to P in a one-to-one association, with lazy="no-proxy",
like this: (P's mapping:)
<one-to-one name="c" class="C" property-ref="P" access="field" lazy="no-proxy"/>
P is mapped to C in a many-to-one association, like this: (C's mapping:)
<many-to-one name="p" column="PId" class="P" access="fiel...
In the project there are two data sources: one is project's own database, another is (semi-)legacy web service. The problem is that admin part has to keep them in sync and manage both so that user doesn't have to know they're separate (or, do know, but they do not care).
Here's an example: there's list of languages. Both apps - project ...
Hi,
I'm still learning here and have a question about child collections. I have an aggregate root called Audio, which has a collection of AudioDownloads.
The downloads are records of each IP address which downloads the audio, i don't want to have duplicate records of the same IP for each Audio.
In my domain i have the following functi...
I'm quite new to nHibernate, so this'll probably be a pretty stupid question. But anyway, saving an object works fine, updating it doesn't work.
This is what I'm doing:
using (ISession session = _sessionFactory.OpenSession())
{
session.SaveOrUpdate(schemaChange);
schemaChange.ScriptName = "New one";
session.SaveOrUpdate(sch...
I recently asked a question about using Fluent NHibernate with .NET 4 - I solved that problem, but met a new one.
Summary
My main problem (at the moment) is configuring the database. I'm following this guide, but trying to work against SQL Server 2008 Express instead, as that's what I'll be using and thus what I need to learn.
The fail...
I am using the repository pattern in nhibernate.
In a asp.net mvc application.
I have a httpmodule, that:
beginRequest it calls session.beginTransaction();
EndRequest it calls session.Transaction.Commit();
This is fine for 95% of the time.
I have a case where I need to do the following in a single request:
List<User> users = factory...
Simple question: can NHibernate save a collection without an iterator? For example:
var list = new List<Item>();
list.Add(1000 items);
session.Save(list);
Or do I have to do foreach over the list?
...
I am looking into migrate a large project to Entity Framework 4.0 but am not sure if it can handle my inheritance scenario.
I have several projects that inherit from an object in the “main” project. Here is a sample base class:
namespace People
{
public class Person
{
public int age { get; set; }
public String...
I have an hql query
string hql = @"select distinct ba, bp from BstArea as ba, BstPhoneInfo as bp
where bp.CodeSegment like :mobilePhoneNumber
and ba.AreaCode = bp.AreaCode";
Now, I want to create a query to execute this hql and retrieve the result. I tried
SimpleQuery q = new Simpl...
I am creating DAL with NHibernate. do i need to create classes & mapping files by hand ?
Like in Linq to Sql & Entity Framework they are created automatically by vsts?
Is there any such tool for NHibernate ?
...