Bidirectional Many to Many with BaseClass and tablePerHierarchy false fails

6 views
Skip to first unread message

Tobias Manthey

unread,
Dec 3, 2018, 12:31:53 AM12/3/18
to Grails Dev Discuss
The following example is based on the official bidirectional many-to-many example and will fails with

org.hibernate.AssertionFailure: Table mm_author_books not found

The change is basically deriving from an even emtpy subclass with just with tablePerHierachy set to false. As any uni-directional many-to-many mapping does work based on the same principles I believe this is a bug.

class SomeBase { static mapping = { tablePerHierarchy false } } class Book extends SomeBase { String title static belongsTo = Author static hasMany = [authors: Author] static mapping = { authors joinTable: [name: "mm_author_books", key: 'mm_book_id' ] } } class Author extends SomeBase { String name List books static hasMany = [books: Book] static mapping = { books joinTable: [name: "mm_author_books", key: 'mm_author_id'] } }
Reply all
Reply to author
Forward
0 new messages