Hello
i'm new to hibernate so i need a little help. I already googled for about 4 hours.
Here's my problem
I want to map a generic list like
Code:
public class ClassWithList {
private List<E> list;
}
So I have the following mapping file:
Code:
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="false">
<class name="ClassWithList" table="ClassList">
<list name="list" >
<key column="OBSERVABLELIST_ID"/>
<list-index column="sortOrder"/>
<one-to-many class="________"/>
</list>
</class>
</hibernate-mapping>
My Problem is that i don't know the class of the objects in the list (see the ______ in the mapping file.
Is there any way to tell hibernate that this is a generic list?
The same problem with classes:
What would the mapping file for the following class look like:
Code:
/**
* Class that encapsulates the methods for an observer of this list.
*/
public class ListObserver<E> {
private List<E> myListToObserve;
public void setList(List<E> newList) {
myLisstToObserve = newList;
}
public List<E> getList() {
return myLisstToObserve;
}
}
Thanks for your answers!!!