Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mapping java.util.List

 
Kunal Sathe
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I am relatively new to Hibernate and hence this question. I have a java class that contains elements of the type java.util.List.

public class Application extends DataObject {

private List investments = null;

public List getInvestments() {
return investments;
}

public void setInvestments(List investments) {
this.investments = investments;
}

}


I am creating the Hibernate mapping file. How do I map an attribute of the type java.util.List.

Any help will be highly appreciated. If you can point me to the right place in the documentation, that will be great too.

Regards,
Kunal
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
List is an interface; you need to use an implementing class, like

,
and map it with a <list>.
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Kunal,

from "Java Persistence with Hibernate (Manning 2006)

Item has a List of Bids.




Herman
 
Kunal Sathe
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your responses Edvins and Hermann. I am implementing the solution.

Kunal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic