Grails

using tablePerHierarchy false in a packaged domain class causes croakage

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major 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

Activity

Hide
Corey added a comment -

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.

Show
Corey added a comment - 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.
Hide
Graeme Rocher added a comment -

Bulk closing bunch of resolved issues

Show
Graeme Rocher added a comment - Bulk closing bunch of resolved issues

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: