Issue with serializing Hibernate objects using XStream

前端 未结 6 1519
南笙
南笙 2021-02-04 19:52

I\'ve been facing this issue where, the hibernate objects on serialization produces unexpect xmls containing all the instrumented code from Hibernate.

We did some cleani

6条回答
  •  旧时难觅i
    2021-02-04 20:33

    Haven't used it, but xstream-for-beans seems to fit (quoting):

    This project provides implementation of mappers and converters that enhance XStream on following aspects:

    1. Serialize objects as they are exposed by getters and setters. XStream features available for fields shall work for properties defined for getter/setter proprerties.
    2. Sanitize serialization of managed objects: automatically omit irrelevant fields and class information.
    3. Handle "offline" fields and proxy objects.

    I wrote once custom XStream Converters to deal with this issue, as a part of a closed-source project unfortunately. xstream-for-beans deals with the very same problems, well worth a shot.

    I've used Terracotta's Pojoizer utility successfully in the past, but I don't think it's maintained anymore.

提交回复
热议问题