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.