No I can't store "test" without storing "testChild". (Names a bit confusing
here)
And I want to use <subclass> functionality for "test" class and this causes
a problem since I can not put <subclass> inside <join/> tag.

On Fri, Jan 29, 2010 at 5:36 PM, Fabio Maulo <[email protected]> wrote:

> What I mean is that you can't store a "testChild" without store "test"
> because the ID is the ID of "test" (even more when you are using identity
> where there isn't a chance to know the ID without INSERT a record).
>
>
> 2010/1/29 Petr Syromolotov <[email protected]>
>
>> These ID in table "testChild" and Id in table "test" are same.
>> I understand what you are talking about one-to-one relation smell.
>> But it's a legacy DB I have to support and I hoped that <join
>> inverse="true"/> will work for me.
>>
>> So can you explain what's the difference between inverse="true" and
>> inverse="false" in <join /> tag?
>>
>>
>> On Fri, Jan 29, 2010 at 4:43 PM, Fabio Maulo <[email protected]>wrote:
>>
>>> which is the ID in table "testChild" ? from where it come ?
>>>
>>> Think about that ;)
>>>
>>> 2010/1/29 Petr Syromolotov <[email protected]>
>>>
>>>> Assume I have following mapping:
>>>>
>>>> <class name="test" table="test">
>>>>     <id name="Id">
>>>>       <generator class="native" />
>>>>     </id>
>>>>     <discriminator column="Type" />
>>>>
>>>>     <property name="Name" />
>>>>
>>>>     <join table="testChild" inverse="true">
>>>>        <key column="Id"/>
>>>>        <property name="ChildName" />
>>>>     </join>
>>>>
>>>>         <subclass name="Derived" discriminator-value="derived">
>>>>           <property name="DerivedName" />
>>>>          </subclass>
>>>> </class>
>>>>
>>>> Now I'm trying to add new instance of "test" class to database.
>>>> What I expect is that first record to table "testChild" will be
>>>> inserted. (otherwise what does inverse="true" mean?)
>>>> And only then record to table "test" will be inseted.
>>>>
>>>> The problem is that this does not happen. (:
>>>> First record in  "test" table is inserted and then to "testChild".
>>>> My DB required that record in testChild is created first (:
>>>>
>>>> I can not move "test" table to <join> tag since I use <subclass>
>>>>
>>>> Is there any solution?
>>>>
>>>>
>>>> PS yes I know that it's a bad DB design but I can not do anything with
>>>> that.
>>>>
>>>>
>>>> Thanks, Peter
>>>>
>>>> --
>>>> 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]<nhusers%[email protected]>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/nhusers?hl=en.
>>>>
>>>
>>>
>>>
>>> --
>>> Fabio Maulo
>>>
>>>  --
>>> 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]<nhusers%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://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]<nhusers%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>
>
>
> --
> Fabio Maulo
>
>  --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://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.

Reply via email to