|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
table-per-subclass mapping but still no NOT-NULL constraintAs per section 5.5.2.3 Inheritance Strategies, in the reference guide: "By default GORM classes uses table-per-hierarchy inheritance mapping. This has the disadvantage that columns cannot have a NOT-NULL constraint applied to them at the db level." ... which would lead me to believe that by setting table-per-hierarchy to false, would circumvent that disadvantage and allow columns to have a NOT-NULL constraint appled to them at the db level. However, that does not appear to be the case: class Payment { Integer amount static mapping = { tablePerHierarchy false // use table-per-subclass } static constraints = { amount( nullable: false ) // NOT NULL applied as expected on db } } Table "public.payment" Column | Type | Modifiers ---------+---------+----------- id | bigint | not null version | bigint | not null amount | integer | not null class CreditCardPayment extends Payment { String cardNumber static constraints = { cardNumber( nullable: false ) // NOT NULL is _not_ applied on db, why? } } Table "public.credit_card_payment" Column | Type | Modifiers -------------+------------------------+----------- id | bigint | not null card_number | character varying(255) | Is this a bug ( using grails 1.0.3 ), or am I missing something - i.e. gorm purposefully will not automatically apply the NOT-NULL constraint on the db in cases of domain inheritance such as this example? --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: table-per-subclass mapping but still no NOT-NULL constraintI just ran into this same issue in Grails 1.1.1. I tried the "tablePerSubclass true" as well without relief.
Any workarounds or should I JIRA this as a bug?
|
|
|
Re: table-per-subclass mapping but still no NOT-NULL constraint> I just ran into this same issue in Grails 1.1.1. I tried the
> "tablePerSubclass true" as well without relief. > > Any workarounds or should I JIRA this as a bug? Looks like it might be a bug. I would JIRA with a reproducible example. Cheers, Peter --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Free embeddable forum powered by Nabble | Forum Help |