GRAILS-1019: Allowing expressions to be used with the 'disabled' attribute for g...
[grails.git] / test / groovy / org / codehaus / groovy / grails / orm / hibernate / OneToOneTests.groovy
blobc267d6332e8c99148092f1da40ca317a61b57e31
1 package org.codehaus.groovy.grails.orm.hibernate
2 /**
3 * Created by IntelliJ IDEA.
4 * User: grocher
5 * Date: Jan 21, 2008
6 * Time: 10:43:34 PM
7 * To change this template use File | Settings | File Templates.
8 */
9 class OneToOneTests extends AbstractGrailsHibernateTests{
11 protected void onSetUp() {
12 gcl.parseClass '''
13 class Face {
14 Long id
15 Long version
16 Nose nose
19 class Nose {
20 Long id
21 Long version
22 Face face
23 static belongsTo = [face: Face]
25 '''
30 void testPersistAssociation() {
31 def faceClass = ga.getDomainClass("Face").clazz
32 def noseClass = ga.getDomainClass("Nose").clazz
34 def nose = noseClass.newInstance()
35 def face = faceClass.newInstance(nose:nose)
37 assert face.nose
38 assert nose.face
40 println face.nose
41 println nose.face
43 assert face.save(flush:true)
45 session.clear()
47 face = faceClass.get(1)
48 nose = noseClass.get(1)
49 assert face.nose
50 assert nose.face