-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Multiple Inhertence / Mix Mode
PostPosted: Tue Jul 29, 2008 11:29 pm 
Newbie

Joined: Fri Oct 27, 2006 3:41 am
Posts: 8
I have the following objects..

BaseResource : IResource

InternalResource : BaseResource
ExternalResource : BaseResource

MimiInternalResource : InternalResource
MimiExternalResource : ExternalResource

When I do a Get (IResource) for an object that should be MimiInternalResource I get the following SQL Error:

Login Failed: could not execute query [ SELECT this_.ResourceId as ResourceId20_0_, this_.Email as Email20_0_, this_.Name as Name20_0_, this_.Salt as Salt20_0_, this_.Password as Password20_0_, this_.UniqueGuid as UniqueGuid20_0_, this_.PassExpires as PassExpi8_20_0_, this_.TimeZoneIndex as TimeZone9_20_0_, this_.LoginAttempts as LoginAt10_20_0_, this_.LastLockout as LastLoc11_20_0_, this_.LastLogin as LastLogin20_0_, this_.IsLockedOut as IsLocke13_20_0_, this_.BusinessPhone as Busines14_20_0_, this_.InActive as InActive20_0_, this_.Guid as Guid20_0_, this_.GuidExpires as GuidExp17_20_0_, this_.PaysResidualsFor as PaysResi2_21_0_, this_.SettingsString as Settings2_22_0_, this_.Question1 as Question3_22_0_, this_.Question2 as Question4_22_0_, this_.Answer1 as Answer5_22_0_, this_.Answer2 as Answer6_22_0_, this_.QASalt as QASalt22_0_, this_.TypeId as TypeId0_ FROM Resource_StateMachine this_ WHERE lower(this_.Email) = ? ] Positional parameters: 0 marty.weel@gmail.com [SQL: SELECT this_.ResourceId as ResourceId20_0_, this_.Email as Email20_0_, this_.Name as Name20_0_, this_.Salt as Salt20_0_, this_.Password as Password20_0_, this_.UniqueGuid as UniqueGuid20_0_, this_.PassExpires as PassExpi8_20_0_, this_.TimeZoneIndex as TimeZone9_20_0_, this_.LoginAttempts as LoginAt10_20_0_, this_.LastLockout as LastLoc11_20_0_, this_.LastLogin as LastLogin20_0_, this_.IsLockedOut as IsLocke13_20_0_, this_.BusinessPhone as Busines14_20_0_, this_.InActive as InActive20_0_, this_.Guid as Guid20_0_, this_.GuidExpires as GuidExp17_20_0_, this_.PaysResidualsFor as PaysResi2_21_0_, this_.SettingsString as Settings2_22_0_, this_.Question1 as Question3_22_0_, this_.Question2 as Question4_22_0_, this_.Answer1 as Answer5_22_0_, this_.Answer2 as Answer6_22_0_, this_.QASalt as QASalt22_0_, this_.TypeId as TypeId0_ FROM Resource_StateMachine this_ WHERE lower(this_.Email) = ?]

It appears my joined sub classes are not part of the query.

Below are my mapping files:


<?xml version="1.0"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" >

<class name="Com.CurveNorth.StateMachine.IResource, StateMachine" table="Resource_StateMachine">
<id name="Id" column="ResourceId" type="Int64">
<generator class="native"/>
</id>

<discriminator column="TypeId" type="string"/>

<property name="Email"/>
<property name="FullName" column="Name"/>
<property name="Salt"/>
<property name="Password" type="String"/>
<property name="UniqueGuid"/>
<property name="PassExpires" type="DateTime" />
<property name="TimeZoneIndex"/>
<property name="LoginAttempts"/>
<property name="LastLockout"/>
<property name="LastLogin"/>
<property name="IsLockedOut"/>
<property name="BusinessPhone"/>
<property name="InActive"/>
<property name="Guid"/>
<property name="GuidExpires" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate"/>

<bag name="ResourcePasswords" inverse="true" lazy="true">
<key column="ResourceId"/>
<one-to-many class="Com.CurveNorth.StateMachine.ResourcePassword, StateMachine"/>
</bag>

<subclass name="Com.CurveNorth.StateMachine.InternalResource, StateMachine" discriminator-value="1333">
</subclass>

<subclass name="Com.CurveNorth.StateMachine.ExternalResource, StateMachine" discriminator-value="1332">
</subclass>
</class>

</hibernate-mapping>




<?xml version="1.0"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" >

<joined-subclass name="Mimi.DM.MimiInternalResource, DM" table="Resource_Mimi_Internal" extends="Com.CurveNorth.StateMachine.InternalResource, StateMachine">

<key column="ResourceId"/>

<many-to-one name="PayResidualsForOrganization" class="Com.CurveNorth.StateMachine.IOrganization, StateMachine">
<column name="PaysResidualsFor" sql-type="bigint" not-null="false"/>
</many-to-one>

</joined-subclass>


<joined-subclass name="Mimi.DM.MimiExternalResource, DM" table="Resource_Mimi_External" extends="Com.CurveNorth.StateMachine.ExternalResource, StateMachine">


<key column="ResourceId"/>
<property name="SettingsString"/>
<property name="Question1"/>
<property name="Question2"/>
<property name="Answer1"/>
<property name="Answer2"/>
<property name="QASalt"/>


</joined-subclass>



</hibernate-mapping>

Any help would be much appreciated.

Can NHibernate handle a subclass based on a discriminator then a joined subclass? Any suggestions for a better approach?


Marty
[/i]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.