Skip to content

Instantly share code, notes, and snippets.

@joeRinehart
Created August 26, 2012 12:45
Show Gist options
  • Save joeRinehart/3478702 to your computer and use it in GitHub Desktop.
Save joeRinehart/3478702 to your computer and use it in GitHub Desktop.
CustomMapping
package recordstore
class Thing {
static mapping = {
version false
autoTimestamp false
}
}
package recordstore
class Thing {
static mapping = {
// Turn off Grails features
version false
autoTimestamp false
// Change the table name
table 'tbl_thing'
}
}
package recordstore
class Thing {
// New property: thingName
String thingName
static mapping = {
// Turn off Grails features
version false
autoTimestamp false
// Change the table name
table 'tbl_thing'
// 'thingName' should be 'thingName', not 'thing_name'
thingName column: 'thing_name'
}
}
package recordstore
class Thing {
// New property: thingName
String thingName
String massiveTextField
static mapping = {
// Turn off Grails features
version false
autoTimestamp false
// Change the table name
table 'tbl_thing'
// 'thingName' should be 'thingName', not 'thing_name'
thingName column: 'thing_name'
// massiveTextField should be whatever Hibernate says 'text' is on MySql
massiveTextField type: 'text'
}
}
package recordstore
class Thing {
// New property: thingName
String thingName
String massiveTextField
static mapping = {
// Turn off Grails features
version false
autoTimestamp false
// Change the table name
table 'tbl_thing'
// 'thingName' should be 'thingName', not 'thing_name'
thingName column: 'thing_name'
// massiveTextField should by a MySql longtext field
massiveTextField sqlType: 'longtext'
}
}
package recordstore
class Thing {
// Many 'Thing' to one 'OtherThing': means 'thing'
// has a foreign key
OtherThing otherThing
static mapping = {
otherThing column: 'otherThingId'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment