Hibernate version: 1.2
For some reason I get a casting error when doing a generic session.load
The following code fails with a cast exception:
Code:
ICat cat = (ICat)session.Load<Cat>("1bda0be1333b45cf9b7da7658dbea5ed");
The following code works and returns the proxy object based on ICat (see the mapping document)
Code:
ICat cat = (ICat)session.Load(typeof(Cat), "1bda0be1333b45cf9b7da7658dbea5ed");
What am I doing wrong here?
Mapping documents:Code:
<class name="Cat" proxy="ICat" table="Cat" lazy="true">
<!-- A 32 hex character is our surrogate key. It's automatically
generated by NHibernate with the UUID pattern. -->
<id name="Id">
<column name="CatId" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex" />
</id>
<!-- A cat has to have a name, but it shouldn' be too long. -->
<property name="Name">
<column name="Name" length="16" not-null="true" />
</property>
<property name="Sex" access="field.camelcase-underscore"/>
<property name="Weight" access="field.camelcase-underscore"/>
<list name="Flees" access="field.camelcase-underscore" cascade="all-delete-orphan">
<key column="CatID"/>
<index column="flee_number"/>
<one-to-many class="Flee"/>
</list>
</class>