Changing how nHibernate stores Saga data in nServiceBus
I am having a problem when I am posting to nServiceBus with a variable length data field. nServiceBus uses nHibernate to create a table named
[NServiceBus].[PendingMentorEmailSagaData]
from the PendingMentorEmailSagaData class. The message field however gets nvarchar (255), I'm looking for a way to set it to nvarchar (MAX).
I tried using the embedded hbm file but I get the error " persistent class PendingMentorEmailSagaData not found
".
This probably means that I cannot figure out which class is also setting the file.
Hbm file:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="PendingMentorEmailSagaData">
<id name="Id" />
<property name="OriginalMessageId" />
<property name="Originator" />
<property name="PendingMentorEmailCommandId" />
<property name="JobBoardCode" />
</class>
</hibernate-mapping>
PendingMentorEmailSagaData is the name of the saga data class.
+3
source to share
1 answer
- Create the PendingMentorEmailSagaData.hbm.xml file in the same project where the saga exists, for example:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:nhibernate-mapping-2.2">
<class name="MY_NAMESPACE.PendingMentorEmailSagaData, MY_ASSEMBLY_NAME" table="PendingMentorEmailSagaData" dynamic-update="true" optimistic-lock="all">
<id name="Id" type="Guid">
<generator class="assigned" />
</id>
<property name="Originator" />
<property name="OriginalMessageId" />
<property name="LargeText" type="StringClob" />
</class>
</hibernate-mapping>
2. Mark this file as an embedded resource
+5
source to share