ContentItem.hbm.xml
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Cuyahoga.Core.Domain.ContentItem, Cuyahoga.Core" table="Cuyahoga_contentitem">
<cache usage="read-write" />
<id name="Id" column="contentitemid" type="Int64" unsaved-value="-1">
<generator class="native">
<param name="sequence">Cuyahoga_contentitem_contentitemid_seq</param>
</generator>
</id>
<property name="GlobalId" column="globalid" type="Guid" not-null="true" />
<property name="WorkflowStatus" column="workflowstatus" not-null="true" />
<property name="Title" column="title" type="String" length="255" not-null="true" />
<property name="Summary" column="description" type="String" length="255" not-null="false" />
<property name="Version" column="version" type="Int32" not-null="true" />
<property name="Locale" column="locale" type="String" length="5" not-null="false" />
<property name="CreatedAt" column="createdat" type="DateTime" not-null="true" />
<property name="ModifiedAt" column="modifiedat" type="DateTime" not-null="true" />
<property name="PublishedAt" column="publishedat" type="DateTime" not-null="false" />
<property name="PublishedUntil" column="publishedUntil" type="DateTime" not-null="false" />
<property name="UrlFormat" column="urlformat" type="String" length="255" not-null="true" />
<many-to-one name="CreatedBy" class="Cuyahoga.Core.Domain.User, Cuyahoga.Core" column="createdby" not-null="true" />
<many-to-one name="ModifiedBy" class="Cuyahoga.Core.Domain.User, Cuyahoga.Core" column="modifiedby" not-null="true" />
<many-to-one name="PublishedBy" class="Cuyahoga.Core.Domain.User, Cuyahoga.Core" column="publishedby" not-null="false" />
<many-to-one name="Section" class="Cuyahoga.Core.Domain.Section, Cuyahoga.Core" column="sectionid" not-null="true" />
</class>
</hibernate-mapping>
StaticHtmlContent.hbm.xml
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<joined-subclass name="Cuyahoga.Modules.StaticHtml.StaticHtmlContent, Cuyahoga.Modules" extends="Cuyahoga.Core.Domain.ContentItem, Cuyahoga.Core" table="cm_statichtml">
<key column="statichtmlid" />
<property name="Content" column="content" type="StringClob" />
</joined-subclass>
</hibernate-mapping>
The relivant code (stipped non related info)
Code:
namespace Cuyahoga.Core.DataAccess
{
public class ContentItemDao<T> : IContentItemDao<T> where T : IContentItem
{
protected Type persistentType = typeof(T);
protected ISessionManager _sessionManager;
public ContentItemDao(ISessionManager sessionManager)
{
this._sessionManager = sessionManager;
}
protected ISession GetNewSession()
{
return this._sessionManager.OpenSession();
}
[Transaction(TransactionMode.Requires)]
public T Save(T entity)
{
this.GetNewSession().Save(entity);
return entity;
}
[Transaction(TransactionMode.Requires)]
public T SaveOrUpdate(T entity)
{
this.GetNewSession().SaveOrUpdate(entity);
return entity;
}
}
}
Debugging this (putting a breakpoint in the SaveOrUpdate method) it is definatley reached and stepping through it seems to run ok, but the SaveOrUpdate method at this.GetNewSession().SaveOrUpdate(entity); just doesn't do anything. No error, but no saved data either.
Let me know if there is anything else you'd like to know. Your help is much appreciated.