Hi,
I have an object A that defines an attribute that is a List<B>. The A class has an appropriate getter and setter for B.
e.g. public List<B> getBList(); public void setBList(List<B> b);
In the database, A's backing table declares a foreign key column referencing the primary key of B's backing table. A many-to-one seems the most appropriate solution for me as I want a uni-directional association from A to B.
My mapping looks like:
<class> ... ...
<joined-subclass name="path.to.A" table="object_a_backing_table"
<key column="object_a_pk_column"
<many-to-one name="bList" column="object_b_pk_column" cascade="none" fetch="join"/> </joined-subclass>
... </class>
When I try to load hibernate in my app context I get the following error :
"org.hibernate.MappingException: An association from the table object_a_backing_table refers to an unmapped class: 'java.util.List'"
I also tried adding the class="java.util.List" attribute on the many-to-one declaration but that failed too.
How do I do a many-to-one mapping? Is a hibernate many-to-one even appropriate for what I am trying to do?
Thanks In Advance!
|