Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 922479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:02:18+00:00 2026-05-15T19:02:18+00:00

Does anyone know if there is a framework out there that is able to

  • 0

Does anyone know if there is a framework out there that is able to strip out Hibernate collections from entity classes to make them serializable? I had a look at BeanLib but it only seems to do deep copies of entities while not allowing me to specify implementation mappings for the collection types in my entity classes. BeanLib currently does not work with Hibernate 3.5 and Spring 3 (I did modify the source code and was able to get it working but I’d rather not do this). Gilead seems like an option, but it seems rather invasive. I’d rather use a simple deep copy framework than weave another framework into my entity and DAO classes.

I have tried using XStream with a custom CollectionConverter and MapConverter with success, however… it’s XStream and I don’t really want to be converting my entity to XML and then back from XML in memory. It’s an awful solution.

Will I just have to create my own framework that behaves like XStream does minus all the XML stuff?

My technology stack is: GWT 2.0.4, GWT-Dispatch, Spring 3.0.1 and Hibernate 3.5.2.

My XStream solution:

XStream xstream = new XStream();

xstream.addDefaultImplementation(java.util.ArrayList.class, org.hibernate.collection.PersistentList.class);
xstream.addDefaultImplementation(java.util.HashMap.class, org.hibernate.collection.PersistentMap.class); 
xstream.addDefaultImplementation(java.util.HashSet.class, org.hibernate.collection.PersistentSet.class);
xstream.addDefaultImplementation(java.util.ArrayList.class, org.hibernate.collection.PersistentBag.class);

Mapper mapper = xstream.getMapper();
xstream.registerConverter(new HibernateCollectionConverter(mapper));
xstream.registerConverter(new HibernateMapConverter(mapper));

String xml = xstream.toXML(entity);
Entity newEntity = (Entity) xstream.fromXML(xml);
  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:02:19+00:00Added an answer on May 15, 2026 at 7:02 pm

    Dozer works well for this. Simply map the bean instance to a copy of itself.

    obj = dozerBeanMapper.map(obj, obj.getClass());
    

    In mapping the instance to a new instance, Dozer ignores whatever specific runtime implementation is used for the collections and instead uses the standard implementations or whatever your classes default to.

    I had a look at BeanLib but it only seems to do deep copies of entities while not allowing me to specify implementation mappings for the collection types in my entity classes.

    I’m curious, why does it matter what implementation is used for your collection types? As a best practice it’s best for your persistent classes to refer to List, Set, etc., the actual implementations shouldn’t matter to anyone who consumes these classes – they just care about the data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know there have any other way that (by not using json_encode and
This is a bit of a crazy question, but does anyone out there know
Does anyone know a free framework for visualizing decision trees that allows the use
Does anyone know of a good software development framework or similar that has the
Does anyone know how to read a x.properties file in Maven. I know there
Does anyone know if there is a way to generate different code in the
Does anyone know if there's a short-hand or convient way of disabling all of
Does anyone know if there have been any changes in Azure publish to allow
Does anyone know if there are new binaries for the castle logging facility using
Does anyone know if there is some type of tool, preferably a Firefox add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.