Plugins You can find out about all the publicly available Grails plugins.

Explicit Insert Plugin

  • Tags: persistence
  • Latest:
  • Last Updated: 27 March 2009
  • Grails version: *
  • Authors: Marc Palmer
0 vote
compile ":explicit-insert:"



Many legacy database files have composite keys and they rarely have a version number or timestamp. The GORM Mapping DSL is fantastic but the Composite ID has an issue when creating a new row. The operation causes an SQL update. The problem arises when the version facility is turned off (via version:false) and the Hibernate generator is set to 'assigned' (id generator:'assigned') -- Hibernate is not able to sense that an insert is required.

This plugin adds a method called insert to all domain classes. It is up to the developer to predicate the call to save() or insert().

Note that Grails 1.0.2 provides a more elegant solution. The method now accepts to explicitly predicate the insert operation. So use this plug-in only for Grails applications that are below version 1.0.2.