Duplicate « Entity « JPA Q&A





1. Duplicate a collection of entities and persist in Hibernate/JPA    stackoverflow.com

I want to duplicate a collection of entities in my database. I retreive the collection with:

CategoryHistory chNew = new CategoryHistory();
CategoryHistory chLast =  (CategoryHistory)em.createQuery("SELECT ch from CategoryHistory ch WHERE ch.date = MAX(date)").getSingleResult;
List<Category> ...

2. JPA persist same entity twice    stackoverflow.com

Hey guys, I just noticed that a part of code I worked on saves the same entity twice. I tried several tricks, like flush() and Transaction REQUIRES_NEW but nothing does it. But I can ...

4. Duplicate entity    forum.hibernate.org

Ok, but that doesn't solve my problem in a convient way. I have more then one collection mapped to an article, and then I have to make duplicates of every object that is a part of the collection; first for every Category in the collection and then for every other object type that are a part of a collection in my ...