• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mapping collections in hibernate

 
John Hogan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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
 
Ramesh Srinivasan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic