Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

[Hibernate] Mapping key/value pairs in a HashMap

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm fairly new to all this and am having a conceptual problem. I've been wading through documentation, but I'm not even sure where I'm supposed to be looking anymore :S

I had an idea that if I use a base class as below, then users could subclass it for there own logic (storing all data in the map rather than instance variables), and hibernate would be able to persist it without changing the DB structure using a single_table inheritance strategy.

1) Is this idea valid?
2) What association is needed to persist the map? It's a component, right? I was thinking a schema along these lines:
Discount
- Id
DiscountParameter
- DiscountId (foreign key to Discount)
- Key
- Value

I've tried a heap of different things, but can't quite get my head around how OneToMany or ManyToMany relates to this situation.

Thanks,
- Xavier


I posted this on the Hibernate Users forum to no avail
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shay,

A very nice article on this,
http://www-128.ibm.com/developerworks/java/library/j-hibernate/


regards,
yakub
reply
    Bookmark Topic Watch Topic
  • New Topic