Alfonso / Max,
Thanks, I tried adding the class to the many-to-one mapping as
suggested:
<many-to-one name="Group" class="CLEDOM.Business.Domain.Group"
column="GroupId" />
And YES! That fixed my original problem!
So now it's all happy.
However the story doesn't end there. I have now got a bit further
with my tests. I have a generic broker (implementing IBroker<T> )
which I use to fetch instances from nHibernate. Standard CRUD stuff.
Before I put the interfaces on my domain objects I would create an
instance of the generic broker with something like:
broker = new Broker<Category>();
But now my domain objects are implementing interfaces I need to use
interfaces with my broker.
eg:
broker = new Broker<ICategory>();
So now when doing this and trying to get an instance from the broker I
get the following error:
"there is no persister for ICategory"
Gahhh!!!!
So I'm still a bit lost.
Max you said your domain model was coded against interfaces. Would
you be able to let me have a sample of one of your classes, it's
interface and corresponding hbm mapping?
I'm not mapping the interface in my nHibernate. Here's my mapping for
Category:
Here's my mapping file for Category:
<?xml version="1.0"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-
import="true" assembly="CLEDOM.Business">
<class name="CLEDOM.Business.Domain.Category" table="CATEGORY">
<cache usage="read-only"/>
<id name="Id" type="int" column="CategoryId">
<generator class="native" />
</id>
<property name="Name" type="string" column="Name"
length="128" /
<many-to-one name="Group" class="CLEDOM.Business.Domain.Group"
column="GroupId" />
</class>
</hibernate-mapping>
So as you can see I'm not mapping the interface ICategory. Should I
be? And if so, how!?!?
Very confused.....!
thanks,
Paul
On Apr 30, 6:24 pm, Maximilian Raditya <[email protected]> wrote:
> On Fri, Apr 30, 2010 at 11:51 PM, Alfonso <[email protected]> wrote:
> > I think you have to specify the actual class in the many-to-one
> > declaration, so instead of:
>
> > <many-to-one name="Group" column="GroupId" />
>
> > use this:
>
> > <many-to-one name="Group" class="CLEDOM.Business.Domain.Group"
> > column="GroupId" />
>
> I think Alfonso is right.
>
> It's the difference between your mapping file (Category) and mine. If I
> remove the class attribute in mine, I get the same error as yours.
>
> --
> Regards,
>
> Maximilian Haru Raditya
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group
> athttp://groups.google.com/group/nhusers?hl=en.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.