import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
+import java.util.logging.Logger;
import javax.persistence.EntityManager;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.wamblee.general.ObjectElem;
import org.wamblee.reflection.ReflectionUtils;
/**
* @author Erik Brakkee
*/
public class JpaMergeSupport {
- private static final Log LOG = LogFactory.getLog(JpaMergeSupport.class);
+ private static final Logger LOG = Logger.getLogger(JpaMergeSupport.class
+ .getName());
/**
* Constructs the object.
aProcessed.add(elem);
- LOG.debug("Setting pk/version on " + aPersistent + " from " + aMerged);
+ LOG.fine("Setting pk/version on " + aPersistent + " from " + aMerged);
Persistent persistentWrapper = PersistentFactory.create(aPersistent);
Persistent mergedWrapper = PersistentFactory.create(aMerged);
processPersistent(mergedValue, persistentValue, aProcessed);
}
}
-
- /**
- * This class provided an equality operation based on the object reference
- * of the wrapped object. This is required because we cannto assume that the
- * equals operation has any meaning for different types of persistent
- * objects. This allows us to use the standard collection classes for
- * detecting cyclic dependences and avoiding recursion.
- */
- private static final class ObjectElem {
- private Object object;
-
- public ObjectElem(Object aObject) {
- object = aObject;
- }
-
- public boolean equals(Object aObj) {
- if (aObj == null) {
- return false;
- }
- if (!(aObj instanceof ObjectElem)) {
- return false;
- }
- return ((ObjectElem) aObj).object == object;
- }
-
- public int hashCode() {
- return object.hashCode();
- }
- }
}