| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Grails
Revision: 7237
Author: graeme
Date: 21 Jul 2008 10:06:03
Changes:fix for GRAILS-3121
Files:| ... | ...@@ -0,0 +1,39 @@ | |
| 1 | package org.codehaus.groovy.grails.orm.hibernate | |
| 2 | /** | |
| 3 | * @author Graeme Rocher | |
| 4 | * @since 1.0 | |
| 5 | * | |
| 6 | * Created: Jul 21, 2008 | |
| 7 | */ | |
| 8 | class AttachMethodTests extends AbstractGrailsHibernateTests{ | |
| 9 | ||
| 10 | protected void onSetUp() { | |
| 11 | gcl.parseClass(''' | |
| 12 | class AttachMethod { | |
| 13 | Long id | |
| 14 | Long version | |
| 15 | String name | |
| 16 | } | |
| 17 | ''') | |
| 18 | } | |
| 19 | ||
| 20 | ||
| 21 | void testAttachMethod() { | |
| 22 | def testClass = ga.getDomainClass("AttachMethod").clazz | |
| 23 | ||
| 24 | def test = testClass.newInstance(name:"foo") | |
| 25 | ||
| 26 | assert test.save(flush:true) | |
| 27 | ||
| 28 | assert session.contains(test) | |
| 29 | ||
| 30 | test.discard() | |
| 31 | ||
| 32 | assert !session.contains(test) | |
| 33 | ||
| 34 | test.attach() | |
| 35 | ||
| 36 | assert session.contains(test) | |
| 37 | } | |
| 38 | ||
| 39 | } | |
| 0 | 40 | \ No newline at end of file |
| ... | ...@@ -564,6 +564,7 @@ | |
| 564 | 564 | } |
| 565 | 565 | metaClass.refresh = {->template.refresh(delegate)} |
| 566 | 566 | metaClass.discard = {->template.evict(delegate)} |
| 567 | metaClass.attach = {->template.lock(delegate, LockMode.NONE)} | |
| 567 | 568 | metaClass.'static'.get = {id -> |
| 568 | 569 | def identityType = dc.identifier.type |
| 569 | 570 |