small medium large xlarge

Back to: All Forums  Grails
01 May 2011, 20:49
narender loganathan (2 posts)

I’m using the exact same code from the book and I’m getting the following error. I wonder if it is related to the below issue where inside the Message domain class there is a reference to the “parent” that is also of type Message.

Caused by: org.codehaus.groovy.grails.exceptions.GrailsDomainException: Property [messages] in class [class tekdays.TekEvent] is a bidirectional one-to-many with two possible properties on the inverse side. Either name one of the properties on other side of the relationship [tekEvent] or use the 'mappedBy' static to define the property that the relationship is mapped with. Example: static mappedBy = [messages:'myprop']
	... 23 more
01 May 2011, 20:55
narender loganathan (2 posts)

Sorry this was my bad.

I had 2 fields named TekEvent. One of them should have been TekUser.

here is my bad code:

class Message {

    String subject
    String content
    Message parent
    TekEvent event
    TekEvent author

    static constraints = {
        content(blank:false, maxSize: 2000)

static belongsTo = TekEvent


You must be logged in to comment