I'm wondering how to persist a property that depends on both regular persisted properties (e.g. string, int) as well as some custom transforms of their own.
For instance suppose I have
class A
{
public int Id {get; set;}
public string SomeString {get; set;}
public object SpecialProperty {get; set;}
}
suppose that persisti...
Hi, this was posted on hibernate.org forums and nhusers list without much luck, so I thought I would try here.
Put simply, suppose I have a class:
class A
{
public virtual object SomeValue { get; set; }
}
the type of SomeValue is basically in the set of .NET IConvertible types (primitives like bool, byte, char, int16, double, floa...
Hi,
There are 2 classes: Product and Image.
The Product has only one Image.
No orphan Images can exist.
This represent composition relationship in UML which means:
Assigning Product.Image a newImage results in following
delete old image;
insert new image;
link new image to the product.
Now I need to map it to the RDBMS...
hello good fellas!
here i am again in my self learning hibernate and personal experiment project to gain more understanding.
Here is the description of my environment:
i have a super model entity that all my model inherit from.it has only id property
i use the genericDAO pattern found on hibernate web site.
Now my problem is that i use ...
I have the following structure:
[Class]
public class SuperClass
{
}
[JoinedSubclass]
public class SubClass : SuperClass
{
}
[Class]
public class ContainerClass
{
[ManyToOne]
public SuperClass SomeProperty {get; set;}
}
However, when retrieving an instance of ContainerClass via Hibernate.ISession.Get, it always returns me an ...
I've recently started using NHibernate and have very little experience.
I have table Projects which can't be changed since it's a part of older system. I need to add ProjectGroup table represeting group of project, so that one project is assigned to only one particular group and group can have many projects assigned to it. I wonder if ...
I'm attempting to implement a PreInsertEvent listener using the latest version of NHibernate. One of the things I want to do with in this listener is find the database table that my entity is going to be mapped too. (Assuming that it is only one table).
Does anyone know where in the IEntityPersister I might be able to find this?
...
I am trying to create a messaging system between users and organizations - that is, a user can send and recieve messages from users or organizations.
So, to support this system, I started with an interface:
public interface IPassableObject<F, T, O>
where F : DomainObject
where T : DomainObject
{
Guid PassedItemId { get; se...
I was wondering if anyone knew how to find what column an entity's property is mapped to using NHibernate and only having the IEntityPersister interface available.
...
Hi,
I was working on the following scenario and ran into a 'stackoverflow' exception.
( I am using nHibernate 2.1, oracle 11, c# 3.5)
I have to persist 2 classes with a many-to-many relation (say, class A has a list of elements of type B)
The relation between those 2 classes is redundant (e.g. class A has owns data which contains al...
I am trying to create a many-to-many association between two child objects.
I have an Application Class which represents the applications available in the system
Application has a many-to-many relationship to the UserRoles Class
Application has a one-to-many relationship to the ApplicationFunctions class
An Application can be relate...
Simple question, hopefully with a simple answer. I was under the impression I should create my tables and then use the map files to map my POCO classes to the database objects. After following some tutorials, I have this code in my Test SetUp:
new SchemaExport(_configuration).Execute(false, true, false, false);
Which, obviously, crea...
Hi
There is o possibility to create a convention for Column naming:
I have this peace of code:
public AutoPersistenceModel Generate()
{
var result = AutoPersistenceModel.MapEntitiesFromAssemblyOf()
.Where(GetAutoMappingFilter)
.WithConvention(GetConventions);
return result;
...
Hi,
I've got to classes Product and Store which have many to many relation
I want deleting of store not to cause deleting of related product
And deleting of product not to cause deleting of related store.
Currently deleting of entity cause exception due to Foreign Key constraint.
Here is this classes and their mapping in fluent hiber...
Hi,
I'm having one self-referencing class. A child has a reference to its parent and a parent has a list of children. Since the list of children is ordered, I'm trying to map the relation using NHibernate's .
This is my mapping:
<class name="MyClass">
<id name="Id">
<generator class="native"/>
</id>
<list name="Children" cas...
Here is my mapping file. I am not sure why I am getting "The 'catalog' s not declared." Please help.
<join schema="roc" catalog="SMMS_APP" table="GenericLookupValue" fetch="join...
I'm working with 2 tables, Employees and a table called EmployeeGroups as follows. I've left out most of the unrelevant columns below. I'm struggling to map the foreign key relationship. Its a one-to-one relationship where not every EmployeeId in the Employees table will exist in the EmployeeGroups table. I'm wondering how to setup the E...
I have a SQL stored procedure which Im trying to use to load a collection of entities. My entities look like this
public class Person
{
public virtual int Id {get;set;}
public virtual string Name {get;set;}
public virtual Colour FavoriteColour {get;set;}
}
public class Colour
{
public virtual int Id {get;se...
I need some help figuring out how to proceed. I'm building an app to manage a record collection and i have the following mappings.
<class name="Soulful.Core.Domain.Model.Record,Soulful.Core" table="Record">
<id name="Id" type="Int32" unsaved-value="0">
<generator class="native" />
</id>
<many-to-one name="Artist" cl...
Hello. I'm having some trouble to create a mapping.
Let's say that persons read books:
class Person : Entity
{
public virtual string Name { get; set; }
public virtual IList<Book> Books { get; set; }
/* ... */
}
class Book : ValueObject
{
public virtual string Name { get; private set; }
public virtual int Pages { ge...