Hi GGeurts and Fabio,

Thanks heaps. Yeah, I resorted to property with private setter and a
protected method on the base class, which is called from sub class
constructor with appropriate discriminator.
It's not the exact way I wanted but it works now.

Thanks heaps.


On Mar 23, 9:19 am, Fabio Maulo <[email protected]> wrote:
> The example in our tests is 1632 days old (more than 4 years).
> Have a look in NHibernate.Test.NHSpecificTest.NH335
>
>
>
> On Tue, Mar 22, 2011 at 5:20 AM, Suman <[email protected]> wrote:
> > My problem is exactly same as described in following post but it
> > hasn't been answered and it's 4 years old post!!!
>
> >https://forum.hibernate.org/viewtopic.php?f=1&t=976655
>
> > In summary, I have table per class hierarchy inheritance and I am
> > using formula in discriminator column. When I try to insert new record
> > (Entity) the insert fails because the generated sql doesn't include
> > the discriminator column.
>
> > Alternatively I could define another property that maps to the column
> > and make discriminator's "insert" attribute to false. However I don't
> > like this approach as it will force me to almost rewrite what formula
> > was there for in the domain object.
>
> > I would really appreciate if anyone else has fixed this problem some
> > better way.
>
> > <class name="Account" table="ACCOUNT" abstract ="true">
>
> > <discriminator column ="ACCOUNT_TY" type ="string" formula="(case when
> > ACCOUNT_TY in ('CASHCARD','ORPHAN','BLACK','EXTERNAL', 'INTERNAL')
> > then 'OTHER' else ACCOUNT_TY end)" />
>
> > <subclass name ="CreditCardAccount" extends ="Account" discriminator-
> > value="PREPAY" dynamic-update="true" >
> > <subclass name ="OtherAccount" extends ="Account" discriminator-
> > value="OTHER" dynamic-update="true">
> > <subclass name ="PostpayAccount" extends ="Account" discriminator-
> > value="POSTPAY">
>
> > --
> > 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.
>
> --
> 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].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to