Archive for 'Nhibernate' Category

Next Page »

Inspecting NHibernate Metadata

12 August 2008

I have a little project based on NSK, it uses a query model to abstract the caller from nhibernate. Despite the reason for having or not a Query Model, I expanded the base translator to translate my Query object into a NHIbernate ICriteria.
To make this translation you need to create alias, if I you create [...]

NHibernate and deleting a group of objects

19 June 2008

If you do not mind to issue a delete for each object, you can delete multiple objects using an overload version of the ISession.Delete() Method, here is an example.

uow.Session.Delete("select A from ActionSpawned A where A.ParentAction = :act",
ParentAction, NHibernateUtil.Entity(typeof(Action)));

The code is quite concise, you specify the query to select a series of object, and pass [...]

Second IUserType of the day - Store a list of string in database with NHIbernate.

30 May 2008

I have an object that has 4 properties of IList<String> type. You can natively map these properties in a separate table with this simple mapping

<bag name="keys" access="field" cascade="all-delete-orphan" table="Keys" fetch="join">
<key column="deps_id" />
<element column="deps_key" type="String" />
</bag>

Ok, this is a simple mapping that store all the keys into another [...]

Today Menu: NHibernate User Type

30 May 2008

Ok, today I faced a really simple problem, I have a domain class with a property of type uri, that seems to be not natively supported by NHibernate. Whenever you face a problem of this type the solution is IUserType, here is the full file, it is so simple to write a user type that [...]

NHIbernate and "collection was not an association" when using bag and composite-element

20 May 2008

Look at this mapping

<bag name="searchDefinition" access="field" cascade="all-delete-orphan" table="RawSearchDefinition" fetch="join">
<key column="ParentObjectId" />
<composite-element class="RawSearchDefinition">
<property name="ExcludeKeyword" column="raws_excludeKeyword" type="String" />
<property name="IncludeKeyword" column="raws_includeKeyword" type="String" />
</composite-element>
</bag>

It seems ok but it has a subtle [...]


Next Page »