Thanks for the reply IIya.
Here is the binding file..
<?xml version="1.0" encoding="UTF-8"?>
< mapping class="Person" name="person ">
<value name="name" field="name"/>
<collection field ="addresses" get-method="getAddresses" set-method ="setAddresses" type="java.util.HashSet">
<structure map-as="Address"/>
</collection>
</mapping>
<
mapping class="Address" name
="address">
<value name="type" field
="type" style="attribute"/>
<value name="street" field
="street"/>
</mapping>
</binding>
</mapping>
</binding>
I don't know if I have to put something in the Address mapping to say that it has an association to Person.
I greatly appreciate your help!!
Thanks
On 7/21/06, Ilya Sterin <[EMAIL PROTECTED]> wrote:
Can you send us your JiBX binding file as well? I think you can just define two mappings and reference the address mapping within your person mapping. Your address mapping will then contain a structure for the person.
Either way, send us your mapping file and we'll take a look.
Ilya Sterin
On 7/21/06, Ravinder Battu < [EMAIL PROTECTED] > wrote: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
-------------------------------------------------------------------------
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
------------------------------------------------------------------------- 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