GRAILS-1019: Allowing expressions to be used with the 'disabled' attribute for g...
[grails.git] / test / groovy / org / codehaus / groovy / grails / orm / hibernate / PessimisticLockingTests.groovy
blob9ded1f99fe261e27fe32e561cf123486ad1e8c62
1 /**
2 * Tests pessimistic locking "lock" method
4 * @author Graeme Rocher
5 * @since 0.4
7 * Created: Sep 5, 2007
8 * Time: 6:57:09 PM
9 *
11 package org.codehaus.groovy.grails.orm.hibernate
12 class PessimisticLockingTests extends AbstractGrailsHibernateTests {
14 void testLockMethod() {
15 def domainClass = ga.getDomainClass("Book2")
17 def book = domainClass.newInstance()
19 book.title = "The Stand"
20 book.save()
22 session.flush()
23 session.clear()
25 book = domainClass.clazz.get(1)
27 book.lock()
28 book.title = "The Shining"
29 book.save()
33 void testLockStaticMethod() {
34 def domainClass = ga.getDomainClass("Book2").clazz
36 def book = domainClass.newInstance()
38 book.title = "The Stand"
39 book.save(flush:true)
41 session.clear()
43 book = domainClass.lock(1)
45 assert book
49 void onSetUp() {
50 gcl.parseClass(
51 """
52 class Book2 {
53 Long id
54 Long version
55 String title
57 """
61 void onTearDown() {