GRAILS-1019: Allowing expressions to be used with the 'disabled' attribute for g...
[grails.git] / test / groovy / org / codehaus / groovy / grails / orm / hibernate / CircularOneToOneTests.groovy
blobb56addc57b37c1735a09714d3e18da0747948988
1 package org.codehaus.groovy.grails.orm.hibernate
2 /**
3 * @author Graeme Rocher
4 */
5 class CircularOneToOneTests extends AbstractGrailsHibernateTests {
7 protected void onSetUp() {
8 gcl.parseClass('''
10 class CircularOneToOnePerson {
11 Long id
12 Long version
13 CircularOneToOnePerson creator
15 static constraints = {
16 creator nullable:true
19 ''')
24 void testCircularOneToOne() {
25 def testClass = ga.getDomainClass("CircularOneToOnePerson").clazz
27 def test1 = testClass.newInstance()
29 def test2 = testClass.newInstance()
31 assert test1.save(flush:true)
33 test2.creator = test1
35 assert test2.save(flush:true)
37 session.clear()
39 test2 = testClass.get(2)
42 assert test2
43 assert test2.creator