Here is my solution to the problem statement you've given:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.abcd.Request" table="request">
<id name="id" type="int" unsaved-value="0">
<generator class="identity"/>
</id>
<array name="results">
<key column="request_id"/>
<index column="resultindex" type="int" />
<one-to-many class="com.abcd.RequestResult" />
</array>
</class>
<class name="com.abcd.RequestResult" table="requestresult">
<id name="id" type="int" unsaved-value="0">
<generator class="identity"/>
</id>
<list name="requestResultObjs">
<key column="requestresult_id"/>
<index column="objindex" type="int" />
<one-to-many class="com.abcd.RequestResultObject" />
</list>
</class>
<class name="com.abcd.RequestResult" table="requestresult">
<id name="id" type="int" unsaved-value="0">
<generator class="identity"/>
</id>
<list name="requestResultObjs">
<key column="requestresult_id"/>
<index column="objindex" type="int" />
<one-to-many class="com.abcd.RequestResultObject" />
</list>
</class>
<class name="com.abcd.RequestResultObject" table="requestresultobject">
<id name="id" type="int" unsaved-value="0">
<generator class="identity"/>
</id>
<many-to-one name="value" class="com.abcd.Value"/>
</class>
</hibernate-mapping>
As I'm new to Hibernate, I'm trying to learn it with the help of this forum. Anybody who has time, please validate the solution.
Thanks,
- Jeevan (G1)
********************************************************
vipcowrie wrote:
class Result {
RequestResult[] results;
}
class RequestResult {
List requestResultObjs; //// This List is really a table ,
//// Its row is a list
//// its cell is all of type: RequestResultObj
}
class RequestResultObj {
Value value;
}
class Value {
int i;
String desc;
}
I must store Result. It's challeging,isn't it? who can solve this problem?