-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Derive ArrayList problem
PostPosted: Thu Jan 26, 2006 1:33 pm 
Newbie

Joined: Thu Jan 26, 2006 12:25 pm
Posts: 3
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.