This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def version = grailsApplication.metadata['app.version'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def grailsApplication = Holders.getGrailsApplication() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyTagLib { | |
static namespace = "my" | |
def input = { attrs, body -> | |
//some business logic here | |
//you can access grails tags in the namespace g | |
out << g.textField(attrs, body) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyExtendedTagLib { | |
static namespace = "my" | |
def grailsApplication | |
def input = {attrs, body -> | |
//some custom logic that changes attrs here... | |
//get the original TagLib, must be the complete path | |
def myTagLib = grailsApplication.mainContext.getBean("packages.MyTagLib") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CompositeDomainClass implements Serializable { | |
//this is part of the pk | |
MyOtherDomainClass otherDomainClass | |
//other fields here... | |
//and we try to map this | |
static mapping { | |
table 'composite_table' | |
id composite: ['id','otherDomainClass'], column: 'my_code_field' | |
otherDomainClass(column: 'other_table_id') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CompositeDomainClass implements Serializable { | |
//this is part of the pk | |
MyOtherDomainClass otherDomainClass | |
//other fields here... | |
//and we try to map this | |
static mapping { | |
table 'composite_table' | |
//id composite: ['id','otherDomainClass'], column: 'my_code_field' | |
id composite: ['id','otherDomainClass'] | |
columns { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this will throw ClassNotFoundException | |
Class clazz = Class.forName(className) | |
//but this will load the class with success | |
Class clazz = Class.forName(className, true, Thread.currentThread().contextClassLoader) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sql = new Sql(dataSource) | |
def tables =["myTable1", "myTable2"] | |
tables.each {tab -> | |
sql.execute("truncate table ${tab}") //ORA-00903 here | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sql = new Sql(dataSource) | |
def tables =["myTable1", "myTable2"] | |
tables.each {tab -> | |
sql.execute("truncate table ${tab}".toString()) //works! | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wordpress.sergiosmind.command | |
import grails.validation.Validateable; | |
import groovy.transform.ToString; | |
@Validateable | |
@ToString | |
class PasswordChangeCommand { | |
//dependency injection for SpringSecurityService | |
def springSecurityService | |
OlderNewer