• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Hibernate Annotation - ManyToMany within same PK on an external table

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.


Ignacio Sebastian
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

I have gone to look for myself. If I should return before I get back, keep me here with this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic