-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix for GRAILS-11310 "Implement hibernate Column Transformers in Doma…
…in classes"
- Loading branch information
1 parent
c092e42
commit 96ce446
Showing
4 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
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 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 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
36 changes: 36 additions & 0 deletions
36
...tastore-gorm-hibernate/src/test/groovy/grails/gorm/tests/CustomColumnReadWriteSpec.groovy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package grails.gorm.tests | ||
|
||
import grails.persistence.Entity | ||
|
||
/** | ||
* Created by graemerocher on 29/04/14. | ||
*/ | ||
class CustomColumnReadWriteSpec extends GormDatastoreSpec{ | ||
|
||
void "Test custom read and write mapping"() { | ||
when:"An entity with a custom read write is saved" | ||
Name name = new Name(name:"bob").save() | ||
session.clear() | ||
name = Name.get(name.id) | ||
|
||
then:"the custom read write were used" | ||
name.name == 'BOBBOB' | ||
} | ||
|
||
@Override | ||
List getDomainClasses() { | ||
[Name] | ||
} | ||
} | ||
|
||
@Entity | ||
class Name { | ||
Long id | ||
Long version | ||
|
||
String name | ||
|
||
static mapping = { | ||
name write:'UPPER(?)', read:'REPEAT(name, 2)' | ||
} | ||
} |