hibernate - Grails many to many relationship not creating expected tables -


hi have 2 domain classes. idea user can create events, guest @ other peoples events:

class event {  appuser creator static belongsto = appuser static hasmany = [guests: appuser] 

and

class appuser {      static hasmany = [friends: appuser, events: event] 

the problem is, expected make creator_id column in event table, , appuser_events table appuser_id , event_id, including creator_id column here , making primary key.

i tried creating event class this:

class event {       static belongsto = [creator:appuser]     static hasmany = [guests: appuser] 

but grails not recognize belongto relationship.

any idea how fix?

ok, solved issue. key add 2 hasmany references event class appuser, , add mappedby, event class contains:

static hasmany = [friends: appuser, events: event, invites:event] static mappedby = [invites: "guests", events: "creator"] 

the appuser class unchanged first example in question.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -