Hi!
I have a rather large dm object that I would like to duplicate. The dm in question is an article object and an article is placed in one or more categories.
I have implemented the clone method in the article class:
Code:
public Object clone(){
Article art = new Article();
art.setCategories(this.getCategories());
return art;
}
And my actual clone code looks like this:
Code:
ArticleHome ahome = new ArticleHome()
Article art = ahome.findById(id);
Article nart = (Article)art.clone();
ahome.persist(nart);
Not surprisingly, this doesn't work. I get:
ArticleHome:49 - persist failed
org.hibernate.HibernateException: Found shared references to a collection: com.ian.dm.Article.categories
How do I get around this?
All the best!