Grails

Bidirectional association between subclasses of same parent class causing MappingException

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.0.2
  • Fix Version/s: 1.0.2
  • Component/s: None
  • Labels:
    None

Description

This domain model (note the related classes share the same super class) :

class Content implements Serializable {
    Long id
    Long version
	String title
	String body

    static mapping = {
        tablePerSubclass true
    }
}
class Version extends Content {
	Integer number
	Content current
    
}
class WikiPage extends Content {
    Set versions
	static hasMany = [versions:Version]    
}

Causes:

org.hibernate.MappingException: Foreign key (FK38B73479FD30F3F3:content [])) must have same number of columns as the referenced primary key (content [id]):
org.hibernate.MappingException: Foreign key (FK38B73479FD30F3F3:content [])) must have same number of columns as the referenced primary key (content [id])

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: