I am having an
issue with the CopyGroup using Eclipselink 2.1, not sure when this
started showing up as this seemed to work on a previous version, possibly
1.3?
It is a somewhat
large object graph and in previous version when we used
ObjectCopyingPolicy it seemed to copy the whole object tree and reset the
primary keys and then when persisted would give us a duplicate copy of the
whole object tree.
Here is our code
now using CopyGroup -
final CopyGroup
copyGroup = new CopyGroup();
copyGroup.cascadeAllParts();
copyGroup.setShouldResetPrimaryKey(true);
return (CpTransaction)
entityManager.getActiveSession().copy(entity,
copyGroup);
The problem is
that it seems to create the whole object tree but it doesn't set the
relationship objects correctly.
Right now the
top level object is CpTransaction, with a relationship to
CpLobs
@OneToMany(cascade = CascadeType.ALL, mappedBy
= "cpTransaction")
@PrivateOwned
private Set<CpLob> cpLobs = new
HashSet<CpLob>(0);
CpLobs looks
like -
@ManyToOne(cascade =
CascadeType.ALL)
@JoinColumn(name = "TRANSACTION_ID",
nullable = false)
private CpTransaction
cpTransaction;
When I look at
the new CpTransaction after the copy it has the new cpLob item in the
HashSet, but the CpLob item's parent cpTransaction is null. If I
leave it at CASCADE_PRIVATE_PARTS, then it seems to set the cpTransaction
parent, but it doesn't seem to cascade down any further into the object
graph than the 2nd Level.
Thanks,
Kevin
This message (including any attachments) is intended only for the use of
the individual or entity to which it is addressed and may contain
information that is non-public, proprietary, privileged, confidential, and
exempt from disclosure under applicable law or may constitute as attorney
work product. If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this communication
is strictly prohibited. If you have received this communication in error,
notify us immediately by telephone and (i) destroy this message if a
facsimile or (ii) delete this message immediately if this is an electronic
communication. Thank you.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
This message (including any attachments) is intended only for the use of
the individual or entity to which it is addressed and may contain information
that is non-public, proprietary, privileged, confidential, and exempt from
disclosure under applicable law or may constitute as attorney work product. If
you are not the intended recipient, you are hereby notified that any use,
dissemination, distribution, or copying of this communication is strictly
prohibited. If you have received this communication in error, notify us
immediately by telephone and (i) destroy this message if a facsimile or (ii)
delete this message immediately if this is an electronic communication. Thank
you.