I'm trying todo JAXB marshalling and running with strange problem. I have three objects in one xml named Column, Row and Table
The table element has references to Column ID and Row ID. In Hibernate, I've one -to-one relation mapped (via many-to-one relationship))
When I generate the xml, I see that in place of ID, the entire record detail tag is getting inserted in my xml.
What I want:
<Hierarchy name="" desc="" title="" >
<Column>
<Column name="" desc="" group="" id=""/>
</Column>
<Row>
<Row id =1 name=" " desc="" id="">
<Row id = 2 name="" desc="" id="" />
</Row>
<Row id = 3 name=" " desc="" id="" />
</Rows>
<table>
<table name="" RowID="" measureID="" filter="" expression="" product="" dataset="" datatype="" subreport="" />
</table>
</Hierarchy>
What I'm getting
<Hierarchy name="" desc="" title="" >
<Column>
<Column name="" desc="" group="" id=""/>
</Column>
<Row>
<Row id =1 name=" " desc="" id="">
<Row id = 2 name="" desc="" id="" />
</Row>
<Row id = 3 name=" " desc="" id="" />
</Rows>
<table>
<table name="" filter="" expression="" product="" dataset="" datatype="" subreport=""
<name =""/>
<RowID>
<id>1</id>
<name></name>
<desc></desc>
</RowID>
<measureID>
<id>1</id>
<name></name>
<desc></desc>
</table>
..............
</table>
</Hierarchy>
I've defined the following relationship in my hibernate mapping file
<many-to-one name="RowID" column="RowName"
class="com.abc.Row" cascade="save-update" lazy="false" not-null="false"></many-to-one>
<many-to-one name="ColumnID" column="ColumnName"
class="com.abc.Column" cascade="save-update" lazy="false" not-null="false"></many-to-one>
In class I've defined the relationship as
public class Table{
private id;
private Row rowID;
Private Column columnID;
..getters/setters
}
Can somebody pls advise as I'm new to JAXB
No comments:
Post a Comment