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

mapping collections in hibernate

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been able to map simple collections using hibernate as below:

@org.hibernate.annotations.CollectionOfElements
@JoinTable(
name = "expense_type_field_names",
joinColumns = @JoinColumn(name = "id")
)
@org.hibernate.annotations.IndexColumn(name = "position")
@Column(name = "fieldNames")
private List<String> fieldNames = new ArrayList<String>();


However, I want to change fieldnames to something like:

private Map<String, List<String> > fieldnames;

I however have no idea how I would map this to hibernate, or even if it is possible. Can someone help me?

Thanks
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by John Hogan:
I have been able to map simple collections using hibernate as below:

@org.hibernate.annotations.CollectionOfElements
@JoinTable(
name = "expense_type_field_names",
joinColumns = @JoinColumn(name = "id")
)
@org.hibernate.annotations.IndexColumn(name = "position")
@Column(name = "fieldNames")
private List<String> fieldNames = new ArrayList<String>();


However, I want to change fieldnames to something like:

private Map<String, List<String> > fieldnames;

I however have no idea how I would map this to hibernate, or even if it is possible. Can someone help me?

Thanks



Hi Hogan,

I don't get your question. please be more specific?
reply
    Bookmark Topic Watch Topic
  • New Topic