Hi Jörg,
Jörg Schaible <Joerg.Schaible@...> writes:
>
> Hi Alexander,
>
> Alexander Buchholtz wrote:
>
> > Hi Jörg,
> >
> > Jörg Schaible <joerg.schaible <at> ...> writes:
> >
> >>
> >> Actually I have no experience with the Hibernate stuff at all, therefore
> >> I don't know, if it really can make a difference. However, I'd be
> >> wondering.
> >>
> >> Can you create a version of the classes above without the Hibernate
> >> stuff, create an instance and marshal that to XML?
> >>
> >> How do you initialize the XStream instance?
> >>
> >> - Jörg
> >>
> >
> > I'll double check without the Hibernate mappings on Monday. But one of the
> > benefits of the Hibernate extension is automatic loading of lazy
> > collections and attributes. I would rather not miss this, as the above
> > code is just a small portion of the data model.
>
> Somehow we have to identify what causes the problem with the ignored
> settings.
>
> > I pretty much initialize the xstream following the tutorial:
> >
> > final XStream xstream = new XStream(new StaxDriver()) {
> >
> > <at> Override
> > protected MapperWrapper wrapMapper(final MapperWrapper next) {
> > return new HibernateMapper(next);
> > }
> > };
> >
> > Mapper mapper = xstream.getMapper();
> > xstream.registerConverter(new HibernateProxyConverter());
> > xstream.registerConverter(new
> > HibernatePersistentCollectionConverter(mapper));
> > xstream.registerConverter(new HibernatePersistentMapConverter(mapper));
> > xstream.registerConverter(new
> > HibernatePersistentSortedMapConverter(mapper));
> > xstream.registerConverter(new
> > HibernatePersistentSortedSetConverter(mapper));
> >
> > String xml = xstream.toXML(workflowRole);
>
> And where are here now the calls to XStream.omitField or XStream.alias?
I'm currently trying to isolate the issue for you to reproduce in a small
test project.
In my last code snippet I forgot to add the call to omit the Ids
accidentally (as I have to remove allot of stuff to reduce complexity of the
code). So here it comes:
private static final Class[] CLASSES_TO_EXCLUDE_ID_FIELD = new Class[] {
WorkflowRole.class,
WorkflowRoleNameLocalization.class,
LocalizationName.class
};
protected void omitIDFields(final XStream xstream) {
for (Class clazz : CLASSES_TO_EXCLUDE_ID_FIELD) {
xstream.omitField(clazz, "id");
}
}
and the call to omitIDFields right before toXML call:
...
omitIDFields(xstream);
String xml = xstream.toXML(workflowRole);
...
>
> > I would appreciate if you or anyone else has some other ideas.
>
> As said, although I have no experience with Hibernate, I cannot real imagine
> that the problem is related to Hibernate.
>
> Cheers,
> Jörg
>
I'll send an update once I've isolated a test case, so far no success to
reproduce in my test project.
Thanks,
Alexander
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email