What you're looking for is the "post-set" attribute - the
Jibx tutorial shows an example almost identical to the one below: http://jibx.sourceforge.net/tutorial/binding-extend.html;
just substitute Person and Address for Order and Item in the example. If
you attach your binding I can show you how you'd do
this.
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ravinder Battu
Sent: Friday, July 21, 2006 10:57 AM
To: jibx-users@lists.sourceforge.net
Subject: [jibx-users] JIBX and Hibernate - bi-directional references
I am new to JiBX. I am trying to read an XML document, marshall it
to Java Objects (POJO's) and persist them using hibernate.
Here's an example of what I am trying to do: A Person can have many
addresses
<person>
<name>Joe</name>
<address
type="home">
<street>Home street</street>
</address>
<address
type="business">
<street>Office
street</street>
</address>
</person>
I have POJO's for Person and Address created (which are hibernate
friendly)
public class Person {
private string name;
Set addresses;
// No arg
constructor
// Getters and Setters
etc.
}
public class Address {
private string type;
private string street;
private Person addressFor;
// No arg constructor
// Getters and
setters
}
When I use JiBX and marshall my XML document and try to persist it, I get
an NullPointerException because the addressFor field in Address object is not
getting set.
Any ideas on how I can do this?
I appreciate your help!!
Thanks
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users