1 package org
.codehaus
.groovy
.grails
.orm
.hibernate
3 import org
.hibernate
.Session
6 * @author Graeme Rocher
9 * Created: Mar 12, 2008
11 class BidirectionalListPersistTests
extends AbstractGrailsHibernateTests
{
13 protected void onSetUp() {
21 static hasMany = [elements:TestFaqElement]
29 TestFaqSection section
34 void testListPersisting() {
35 def sectionClass
= ga
.getDomainClass("TestFaqSection")
36 def section
= sectionClass
.newInstance()
39 def element
= ga
.getDomainClass("TestFaqElement").newInstance()
40 element
.question
= "question 1"
41 element
.answer
= "the answer"
42 section
.elements
= [element
]
52 section
= session
.get(sectionClass
.getClazz(),1L)
55 assertEquals
1, section
.elements
.size()