• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

many to many problem

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey ppl, I'm new to hibernate and I'm working on this erd with many to many relatio

Table 'user':

* id: integer

username: varchar
------------------------------------------------------------------

table 'user_info':

* user_id: integer (pk,fk: ref:table 'user' column:'id')

* info_id: integer (pk,fk:ref:table 'info' column:'id')

info_value: text
------------------------------------------------------------------

table 'info':

* id: integer

info:varchar
------------------------------------------------------------------

it's simple many to many relation between user and info tables with the join table user_info that have a third column that contains a requried value holded for the intersection between user and information.

I've made a bean for that table and in the mapping for tables user and info i added the composite-element tag in the set collection and inverse attribute in each of them and now i can get the value from the join table.

until now every thing is great but first problem i have is i must use a map collection so i can get the value with it's key that will be the name of the info in the 'info' table but i couldnt put the key of the map from that table

second problem i got is that i can only retrieve data from that column (third column) which is a very important, actually it's the purpose of the system depends on the storing and retrieving values from this column

so please can any one help me out in this ,how to map these tables and how can i populate and retrieve values from them

or just tell me about a good book that explain like this problem in full details, I've read hibernate quickly and hibernate in action but i couldn't find a proper solution for this problem

thanks
 
I hired a bunch of ninjas. The fridge is empty, but I can't find them to tell them the mission.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic