Hi
I create a class which derive an ArrayList and i don't know how to map it in hibernate xml file
here is what i have do
class Row
{...........
private Test mytest;
//accessors
public Test getMyTest()
{
return mytest;
}
public setMyTest(Test mytest)
{
this.mytest = mytest;
}
}
class RowList extends ArrayList
{
//add some custom methods
...............
}
class Test
{................
private RowList rList;
//accessors
public RowList getRList()
{
return rList;
}
public setRList(RowList rList)
{
this.rList = rList
}
}
here is xml mappings:
1. for Test
<?xml version="1.0"?>
<hibernate-mapping>
<class name="Test" table="Test">
<id name="id" column="id">
<generator class="sequence">
<param name="sequence">seq_test</param>
</generator>
</id>
<property name="......."/>
<bag name="rList" inverse="true" cascade="all-delete-orphan">
<key column="c_mytest"/>
<one-to-many class="Row"/>
</bag>
</class>
</hibernate-mapping>
2. for Row
<?xml version="1.0"?>
<hibernate-mapping>
<class name="Row" table="Row">
<id name="id" column="id" >
<generator class="sequence">
<param name="sequence">seq_row</param>
</generator>
</id>
<property name = ".............."/>
<many-to-one name = "mytest" column="c_mytest" class="Test"/>
</class>
</hibernate-mapping>
an error when i try to save Test is:
org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of Test.setRList
It's work when the property rList is an of ArrayList type, but when change the type with RowList - dosn't work! I think tnat the mistake is in the mapping xml file for Test(wrong type of "bag" maybe)
Thanks a lot for help!
Regards,
cool_boy1
|