Hi Rohit,

if I undestood it right, I think you have to add some extra logic to your 
importer:

1. After unmarshalling the object which contains the reference (let's call it 
object A) access the referenced object (let's call it B) and fetch it's primary 
key.

2. Because an object with the same attributes as B (let's call it C) is already 
persistent in your system, you can use this PK to fetch it with Hibernate.

3. Now replace A's reference to B by a reference to the persistent C. B can be 
discarded.

4. Make A persistent. Hibernate will recognize that it's connected to C and 
that C hasn't changed - so only A will be inserted and it will have a reference 
to C.

Alexander

> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Auftrag von 
> Rohit Seth
> Gesendet: Mittwoch, 12. Oktober 2005 17:56
> An: [email protected]
> Betreff: [jibx-users] Using JibX with hibernate
> 
> 
> Hi,
> 
> I am trying to use jibx with Hibernate. My goal is to pull 
> data out of one
> system (in form of hibernate objects), marshall them to xml 
> files using
> jibx and then use these xml files to import data on some other system.
> 
> I am able to export data from source system successfully but 
> having some
> issue with import.
> 
> While importing data, there could be a case where a new 
> object has to be
> created which reference to some existing object. While 
> marshalling jibx
> pulle out that object in xml file but I don't want that object to be
> created while importing (as that object already exists on 
> target system).
> 
> I'll appreciate any help in this regard.
> 
> thanks
> rohit
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, 
> discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> jibx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
> 


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to