I have the following configuration file for NHibernate:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.connection_string">Server=.\SQLEXPRESS;Database=mydb;Integrated Security=True;</property>
<property name="dialect">NHibe...
I have a table Parent and a table Child. Child contains a foreign-key to the Parent table, creating a one-to-many relationship. Here is a part of my mapping that I define with fluent NHibernate:
public class ParentMap : ClassMap<Parent>
{
public ParentMap()
{
WithTable("Parents");
Id(x => x.Id, "ParentID")
...
Does anyone know why NHibernate generates a field named 'elt' of type int for a many to many mapping?
I'm wondering why I need it.
Thanks
...
NHibernate is driving me 'Nuts'!!!
I have the following mapping.
Which returns this error when I try to add a record to the DB.
"Unknown entity class: System.Int64"
<class name="CalConnector" table="tb_calConnectors" lazy="false" >
<id name="id" column="id">
<generator class="hilo"/>
</id>
<many-to-one name="calendarID" class="Calen...
How do you go about changing the subtype of a row in NHibernate? For example if I have a Customer entity and a subclass of TierOneCustomer, I have a case where I need to change a Customer to a TierOneCustomer but the TierOneCustomer should have the same Id (PK) as the original Customer entity.
The mapping looks something like this:
<cl...
What is the proper way to work with Passwords you don't want to store in clear text in a database? What are my options in NHibernate / Castle ActiveRecord?
UPDATE:
I was interested in how others handle this with NHibernate / Castle ActiveRecord.
And if there was anything built into NHibernate or Castle ActiveRecord.
...
Hi,
I have the following code which works fine.
However, I only want to return rows where eventID = 5;
Where can I add criteria to this query?
tx = session.BeginTransaction();
List<Catergory> Catergories;
using (tx)
{
Catergories = (List<Catergory>)session.CreateCriteria(typeof(Catergory)).AddOrder...
Hey Everyone..
I can't get my update to work. The test fails and I do not see any update statements being sent to the database. Can someone tell me what I'm doing wrong?
This is my repository update procedure:
public void UpdateProject(Project proj)
{
Session.Update(proj);
}
This is the unit test I am trying:
[Test]
pub...
I'm using Nhibernate and fluent nhibernate to create a mapping file for a domain object (though I don't care if an answer uses fluent nhibernate or xml hbm syntax). And I'm having trouble with figuring out how I specify that a set of columns representing a component within the domain object is unique.
Here's the domain object:
public ...
I'm ashamed to say it, but I have to. I have not worked with ORM's. I'm really considering NHibernate as it seems to be the most mature product for .Net out there (please correct me if I'm wrong). Now, the thing is that we have a big e-commerce/booking system with an SqlServer as the main integration point, containing quite a lot of busi...
I've got a object (Filter) that's defined something like this
public class Filter
{
public int FilterId { get; set; }
public string Name { get; set; }
public IList<User> Users { get; set; }
}
If possible, I'd like to store the object in multiple tables (sometimes spanning multiple rows)
Given an initialization o...
Hello.
There is need for quering NHibernate for several instances of the entity. I've tried following code, but it failed with wired NRE indepth of NHibernate.
var query = NHibernateSession.CreateQuery("from User u where u.id in (:ids)");
query.SetParameterList("ids", new Guid[]);
query.ToList();
It looks like common problem - any s...
I discovered that one of the tables of a legacy db I'm working on has a colum named "Order".
Unfortunately I cannot change the DB structure.
My Fluent NHibernate class looks like
public class SiteMap : AutoMap<Site>
{
public SiteMap() {
WithTable("Sites");
Id(x => x.ID, "Id")
.WithUnsavedValue(0)
...
I have a very strange problem: NHibernate crashes when being called from a web user control.
I am working on a ASP.Net (2.0) web page which uses NHibernate to access a database.
And I have a simple factory class to access a column CurrentStepNumber in the table ProjectInfo:
public class ProjectEntity
{
private int? _currentStepNum...
I'm mapping a ProductCategory tree using Fluent NHibernate and everything was going fine until I tried to walk the tree that is returned from the database to ensure it's saving and retreiving appropriately.
Here's how I'm testing:
Instantiate 4 categories: Beverages, Beer, Light Beer, and Dark Beer
Add Beer to Beverages, then Light Be...
I try to use NHibernate.Search that I built from trunk and use with NHibernate 2.0.1. When I add some NHibernate.Search properties config into configuaration file:
<property name="hibernate.search.default.directory_provider">NHibernate.Search.Storage.RAMDirectoryProvider, NHibernate.Search</property>
<property name="hibernate.search.def...
To keep my integration tests independent I remove all old data and insert new test data before each test. Is there a better way of doing this than simply querying for all entities and deleting them one by one?
I have considered writing a stored proc that runs "delete from tablename;" for each table that is to be cleared. That ought to q...
Hi I need to pass some objects to and from .Net and a Flex presentation layer.
I need to pass and recieve the following object.
public class Room: BasicRoom
{
private int _seatingCap;
private RoomType _roomType;
private IList<Equipment> _equipment;
public virtual RoomType roomType
{
get { return _roomType; }...
I have a list of 10 data objects that I want to insert/update to the database using NHibernate. If one throws an exception (say a primary key violation) I want to still insert/update the other 9. I rolled each object operation into its own atomic transaction, and roll back the transaction if there is an exception. Problem is that if a tr...