• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

[Hibernate] Mapping a Map question

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have a Company entity which has a Map property called "companyValues".

private Map<Competence, Integer> companyValues;

The companyValues property uses a Competence entity as its key. Competence is another mapped entity in the system.

Could you explain how I would create this mapping in the Company mapping?

This is the Competence, which is just an id and a name for now.


And this is the Company with the companyValues mapping.




Is the companyValues property in the Company mapping correct like this? Or will this result in an <Integer, Integer> Map? I mean, will Hibernate understand that I need the entire Competence object as the key and return a <Competence, Integer> Map or will it return a <Integer, Integer> Map with the COMPETENCE_ID as the first integer?

Thanks!
 
Ruben Matthews
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hah! I may have once again answered my own question right after I posted it. I guess the companyValues mapping was wrong and that I must use a <index-many-to-many> tag with a class attribute instead of the plain <index> tag?

 
I'm full of tinier men! And a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic