I'm not too familiar with generics (concept or the syntax) in general (short of using them in collections and what not), but I was wondering if the following is the best way of accomplishing what I want. Actually, I'm not entirely positive generics will solve my problem in this case.
I've modelled and mapped a few dozen objects in NHibe...
I have a database that contains a table that looks a bit like this:
PropertyId, EntityId, Value
PropertyId and EntityId are a combined primary key. Every Entity is spread over a couple of rows where every row contains a single property of the entity. I have no control over this database so I'll have to work with it.
Is it possible to ...
I have a scenario in a system which I've tried to simplify as best as I can. We have a table of (lets call them) artefacts, artefacts can be accessed by any number of security roles and security roles can access any number of artefacts. As such, we have 3 tables in the database - one describing artefacts, one describing roles and a many-...
Somewhat-simplified example situation: I have entities A and B which are incredibly "heavy" domain objects. Loading one from the database is a pretty big deal. Then I have an entity C, which is a very simple object that has a label string, one A, and one B -- both lazy.
I'm doing some low-level querying to create huge lists of C, so I k...
I would like to know if there is a way to disable automatic loading of child records in nHibernate ( for one:many relationships ).
We can easily switch off lazy loading on properties but what I want is to disable any kind of automatic loading ( lazy and non lazy both ). I only want to load data via query ( i.e. HQL or Criteria )
I woul...
We're working on an hospital information system that is being written on C# and using NHibernate to map objects to database. MVC pattern is being used to separate business logic from UI. Here is the problem,
How do you get variable sized different set of strings to UI?
For example a Contact object have a property named City that holds ...
Hi,
i'm fairly new to NHibernate and although I'm finding tons of infos on NHibernate mapping on the web, I am too silly to find this piece of information.
So the problem is, i've got the following Model:
this is how I'd like it to look. One clean person that has two Address Properties.
In the database I'd like to persist this in ...
I believe this is a common question / problem but have not been able to find a good clean concise answer.
The Problem
How to map entities that appear to have an inheritance relationship:
Company
Supplier
Manufacturer
Customer
However, a Supplier can be a Manufacturer.
or
Person
Doctor
Patient
Employee
Where a Patient...
I couldn't figure out why NHibernate is doing this.
Here's part of my table in MS SQL
CREATE TABLE Person (
nameFamily text,
nameGiven text
)
Here's Person.hbm.xml
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Infosci.Dpd.Model.Person,Infosci.Dpd.Model" table="Person" lazy="true">
<property type="stri...
I am trying to issue a SQL update statement with nHibernate (2.0.1GA) like this:
sqlstring = string.Format("set nocount on;update myusers set geo=geography::Point({0}, {1}, 4326) where userid={2};", mlat, mlong, userid);
_session.CreateSQLQuery(sqlstring).ExecuteUpdate();
However I receive the following error: 'geography@p0' is not a ...
I am setting up an Oracle connection for Nhibernate for the first time. I have copied the Oracle.DataAccess.dll file into my bin folder. No matter what I try, I keep getting the same error:
Could not load type >NHibernate.Driver.OracleDataClientDriver. Possible cause: no assembly name specified.
I am using the following configuration:...
I have an Oracle database and the boolean fields are CHAR(1) with Y/N stored. How can I map this to a bool type using nHibernate?
...
I have a Oracle database and one of the fields is a date range field. It is basically just stored in the database as a VARCHAR(40) in the format YYYY/MM/DD-YYYY/MM/DD. I want to map it in nHibernate to a custom class I have created like this
public class DateTimeRange
{
public DateTimeRange(DateTime fromTime, DateTime toTime)
{
...
I had a method with a lot of persistence calls that used a nHibernate session, it worked, was alright. But I needed to refactor this method, extracting a method from a content inside a loop, for multithread reasons. Then I created an class with this method. It is like a normal refactoring, but the nHibernate session inside this method ca...
I was mapping a relation using something like the following
<map name="Foo" cascade="all-delete-orphan" lazy="false">
<key column="FooId"/>
<index column="FooType" type="Domain.Enum.FooType, Domain"/>
<element column ="FooStatus" type="Domain.Enum.FooStatus, Domain"/>
</map>
The class is like this
namespace Domain {
public...
I'm working on a business application which is being developed using DDD philosophy. Database is accessed through NHibernate and data layer is implemented using DAO pattern.
The UML class diagram is shown below.
http://img266.imageshack.us/my.php?image=classdiagramhk0.png
I don't know the design is good or not. What do you think?
B...
I have an existing database with the table Transactions in it. I have added a new table called TransactionSequence where each transaction will ultimately have only one record. We are using the sequence table to count transactions for a given account. I have mapped this as a one-to-one mapping where TransactionSequence has a primary key o...
I have a situation where I have two entities that share a primary key (Transaction and TransactionDetail). I have them mapped using many-to-one relationship from Transaction to TransactionDetail and from TransactionDetail to Transaction. Transaction detail holds one record for each transaction.
However, when I create a new transaction ...
Hi,
Can I map the identity of an entity to a column whose values are not auto-generated (but still unique)?
If so, what should I put in the xml identity/generator tag?
Thanks.
...
Here is a simplified version of my database model. I have two tables: "Image", and "HostingProvider" which look like this:
[Image]
id
filename
hostingprovider_id
[HostingProvider]
id
base_url
Image HostingproviderId is a many-to-one foreign key relationship to the HostingProvider table. (Each image has one hosting provider).
...