Hi,
I'm new to Grails. I'm having the folling problem with my database model:
Two of my domain classes (User and Post) have multiple one-to-many associations between them. User may like, dislike, see or own multiple Posts. For this I have set up hasMany relationship as following:
After developing owning side of my code when I started to work with seen I saw that each object that is in posts list is also in seen, likes and dislikes. Then I tried to use joinTable to map tables:Code:static hasMany = [posts:Post, seen:Post, likes:Post, dislikes:Post]
But unfortunately nothing changed, posts added to posts still go to other lists too.Code:static mapping = { posts joinTable: [name: 'USER_POSTS', column: 'POST_ID', key: 'USER_ID'] seen joinTable: [name: 'USER_SEEN', column: 'POST_ID', key: 'USER_ID'] likes joinTable: [name: 'USER_LIKES', column: 'POST_ID', key: 'USER_ID'] dislikes joinTable: [name: 'USER_DISLIKES', column: 'POST_ID', key: 'USER_ID'] }
What would you suggest to do?


Reply With Quote
