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.
