У меня есть свежий Grails 1.3.7 с двумя классами предметной области с некоторыми хитрыми отношениями:
class NodePoint {
String name
static mappedBy=[outgoingConnections:'startPoint',incomingConnections:'endPoint']
static hasMany=[outgoingConnections:Connections, incomingConnections:Connections]
}
class Connections {
NodePoint startPoint
NodePoint endPoint
}
Я делаю что-то не так в начальной загрузке (проект "todaysstupidproblem"):
import todaysstupidproblem.*
class BootStrap {
def init = { servletContext ->
def startingPoint = new NodePoint(name:"This Point").save(failOnError:true)
def endingPoint = new NodePoint(name:"That Point").save(failOnError:true)
def someConnex = new Connections(startPoint:startingPoint,endPoint:endingPoint).save(failOnError:true, flush:true)
println someConnex
println "WHY ISNT THERE SOMETHING BETWEEN THESE???"
startingPoint.outgoingConnections.each{
println "WHY AM I NOT SEEING THIS!!?!?!?!?"
println "Where did the outgoingConnections go?"
println it
}
println "HIBERNATE FTL :("
}
def destroy = {
}
}
печатает:
Running Grails application..
todaysstupidproblem.Connections : 1
WHY ISNT THERE SOMETHING BETWEEN THESE???
HIBERNATE FTL :(
Server running. Browse to http://localhost:8080/todaysstupidproblem
Почему не печатается соединение?