wood burning stoves*
The moose likes Object Relational Mapping and the fly likes Mapping  java.util.List Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Mapping  java.util.List" Watch "Mapping  java.util.List" New topic
Author

Mapping java.util.List

Kunal Sathe
Ranch Hand

Joined: Apr 08, 2005
Posts: 49
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

Joined: Dec 11, 2006
Posts: 364
List is an interface; you need to use an implementing class, like

,
and map it with a <list>.
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi Kunal,

from "Java Persistence with Hibernate (Manning 2006)

Item has a List of Bids.




Herman
Kunal Sathe
Ranch Hand

Joined: Apr 08, 2005
Posts: 49
Thanks for your responses Edvins and Hermann. I am implementing the solution.

Kunal
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Mapping java.util.List
 
Similar Threads
Problem in many to one relation.
null pointer exception
why Index element require in List and one to many mapping
retrieving object hierarchy - many-to-one?
Defining HQL in clause parameter on a collection filter