• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic