Updating data on the server side

GORM Mapping

Use belongsTo or fkId (A.ID = B.A_ID):

  • belongsTo
    • in a Grails bulk creation transaction, IDs are created when the transaction flushes
    • newly created item A doesn't have A.ID to be used as the fk B.A_ID
    • using belongsTo allows object reference
  • fkId
    • A and B don't need to be created in a single transaction
    • this allows flat object to convert to map for json

results matching ""

    No results matching ""