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]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
