• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Annotation - ManyToMany within same PK on an external table

 
Ignacio Sebastian
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

This is my first post here. I am facing an issue with an annotation mapping with hibernate.

The thing is than I need to manage which messages where sent from an Account to other Account, and the actual state than this message is in(Read, Unread, etc).

Table diagram is this





This is the code than I have for now.






I still couldn't figure out how to map this relationship with the appropriate annotations.

I know than mapping cross-table must be done with ManyToMany relationships. Anyway, in this case looks something more complex than that. First, because of this multiple relationship within the same table represented with (accountfrom, accounto) and then this must be map with msg table.

Please let me know if you need more information about this.

Thanks!


IS
 
Ignacio Sebastian
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, researching a little bit more. I have finished on this solution.






Opinions are welcome, but useful comments are preferred

IS
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic