Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 1.0.1
-
Fix Version/s: 1.0.2
-
Component/s: Persistence
-
Labels:None
-
Testcase included:yes
Description
package payment class Payment { Long id Long version Integer amount static mapping = { tablePerHierarchy false } }
package payment class CreditCardPayment extends Payment { String cardNumber }
def ccPayment = new CreditCardPayment( cardNumber : '1234567890', amount : 10 ) assert ccPayment.save(flush:true), "failed to save: ${ccPayment.errors}"
Causes:
could not insert: [payment.FailsCreditCardPayment]; nested exception is org.hibernate.exception.ConstraintViolationException: could not insert: [payment.FailsCreditCardPayment] ... Caused by: java.sql.SQLException: Attempt to insert null into a non-nullable column: column: CLASS table: FAILS_PAYMENT in statement [insert into fails_payment (id, version, amount) values (null, ?, ?)]
grails bug-report is attached
Just a note: the 'payment.FailsCreditCardPayment' and 'FAILS_PAYMENT' as shown in the exception snippet was due to a cut and paste mismatch while I was commenting.