Ok I understand that.
But that cannot be the option since our domain model is quite large (67 
different domain objects with many one-to-many associations and still growing).


-----Ursprüngliche Nachricht-----
Von: Jörg Schaible [mailto:[email protected]] 
Gesendet: Mittwoch, 17. Oktober 2012 07:41
An: [email protected]
Betreff: [xstream-user] Re: Hibernate associations

Hi Sebastian,

Sebastian Götz wrote:

> Hello Users,
> 
>  
> 
> I am trying to use XSTREAM as serialization engine to backup my database.
> We use hibernate as OR mapper.
> 
> My intention is to serialize table by table (entity class by entity 
> class). And so I came across associations.
> 
> If I serialized each table standalone at the end I will have any 
> instance serialized. The problem now is to enforce the foreign key. So 
> I want to only serialize the unique id for associated entities.
> 
> So when restoring the database again I can easily recreate the 
> constraints.
> 
>  
> 
> How can I achieve this? All may entities derive from a base class so I 
> have a good point to start at. But I do not know how to detect in a 
> converter whether the current object is a top level entity or an 
> association.


Jamie is the Hibernate expert, I am not using it. So my answer might be a bit 
naive in the light of his experience.

I would simply declare local converters for the fields with the foreign key. 
These converters should write the id at serialization and restore from it the 
object at deserialization.

- Jörg



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to