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