Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-dev] discoverUnregisteredNewObjects doesn't populate knownNewObjects but unregisteredExstingObjects

I have an existing object with a mapped collection that uses no indirection. When I load my existing object and add a new item in the collection the item sequence is never generated. EclipseLink code generates sequence only to the new object after method below is called. However, method below ends-up putting my new object in unregisteredExistingObjects instead of knownNewObjects.

 

I do not have validation enabled or validate existence enabled. I do not see how the existing code is able to implement persistence by reachability.

 

If

(!shouldValidateExistence() || checkForUnregisteredExistingObject(object)

 

become

 

(!shouldValidateExistence() && checkForUnregisteredExistingObject(object)

 

that will work better.

 

Please comment.

 

public void discoverUnregisteredNewObjects(Map clones, final Map knownNewObjects, final Map unregisteredExistingObjects, Map visitedObjects) {

        // This define an inner class for process the iteration operation, don't be scared, its just an inner class.

        DescriptorIterator iterator = new DescriptorIterator() {

            public void iterate(Object object) {

                // If the object is read-only the do not continue the traversal.

                if (isClassReadOnly(object.getClass(), this.getCurrentDescriptor())) {

                    this.setShouldBreak(true);

                    return;

                }

 

                /* CR3440: Steven Vo

                 * Include the case that object is original then do nothing.

                 */

                if (isSmartMerge() && isOriginalNewObject(object)) {

                    return;

                } else if (!isObjectRegistered(object)) {// Don't need to check for aggregates, as iterator does not iterate on them by default.

                    if ((shouldPerformNoValidation()) && (!shouldValidateExistence() || checkForUnregisteredExistingObject(object))) {

                        // If no validation is performed and the object exists we need

                        // To keep a record of this object to ignore it, also I need to

                        // Stop iterating over it.

                        unregisteredExistingObjects.put(object, object);

                        this.setShouldBreak(true);

                        return;

 

                    }


Back to the top