0

I have 3 tables: user, role, project. In addition, I created a table that links them all together and has the structure like this: id, id_user, id_role, id_project. I would like, using annotation, in the user class, create a map: Map <Project, Role>.

Is this possible?

Marcin
  • 508
  • 2
  • 10
  • 28

1 Answers1

0

It depends on your hibernate version but you should be able to get this to work. I am not sure what you mean by creating a Map (what would you want stored in it and what would you want the keys to be?)

Check out http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html_single/#entity-mapping-association

You can see all your options related to using @JoinTable and @MapKey

Daniel Williams
  • 8,673
  • 4
  • 36
  • 47
  • Thank you for your replay. The key of the map is project (or its name). I'm using hibernate 4 and spring 3. – Marcin Mar 27 '13 at 21:37