Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyTable {
- Long revisionGroup
- Integer revisionNum = 1
- ...
- static constraints = {
- revisionGroup unique: 'revisionNum'
- }
- static mapping = {
- revisionGroup generator: 'auto'
- }
- }
- //Save new data.
- MyTable myTable1 = new MyTable().save()
- //Do "soft update" of data by saving new revision.
- MyTable myTable2 = new MyTable(revisionGroup: myTable1.revisionGroup, revisionNum: myTable1.revisionNum + 1).save()
- //Save new data.
- MyTable myTable3 = new MyTable().save()
- myTable1: id = 1, revisionGroup = 1, revisionNum = 1
- myTable2: id = 2, revisionGroup = 1, revisionNum = 2
- myTable3: id = 3, revisionGroup = 2, revisionNum = 1
Add Comment
Please, Sign In to add comment