This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Hibernate Annotation - ManyToMany within same PK on an external table  RSS feed

 
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
Boost this thread!