Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Mapping Strategy

 
Joshua Elkino
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having trouble figuring out how to logically create the following entity association.

I have 2 entities. A User and an Event.

1) Each event needs to have a set of users.
2) Each user needs to have a set of users.
3) Each of the user sets per user need to relate to a unique event.

I know how to technically create #1 and #2 but when then having a subset of a set of user per event is driving me nuts in how to impliment that.


If anyone has any ideas, that would be extremely appreciated!

Thanks!
 
Joshua Elkino
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So i think i have logically figured this out, but i need assitance technically.

Logically I created another entity called AttendanceListEnt. This entity will house the user that owns this list, the event it relates to and the lsit of users.


In my UserEnt I added.


I have not modified anything in the EventEnt.
Now i get this error when running.
org.hibernate.MappingException: Could not determine type for: java.util.Set, at table: AttendanceListEnt, for columns: [org.hibernate.mapping.Column(userList)]

I think the whole set inside a set has confused me so if anyone can help me out i would highly appreciate it!

Thanks!
 
Joshua Elkino
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well i found a fix to that error.
In the AttendanceList entity I now have.



This resulted in 2 tables
attendancelist_userent
-AttendanceListEnt_id
-userList_id

and

attendancelist
-id
-event_id
-user_id

Unfortunately i was extecting more tables! Tables to cover the ...

... sets.
Am i right in thinking this would give me more? How can i accomplish this?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic