================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/ejb/cmp3/persistence/PersistenceUnitProcessor.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000001/AB0952363AC40CBFE034080020E8C54E.31 Report generated at Mon Oct 16 16:52:08 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000001/AB0952363AC40CBFE034080020E8C54E.31 Fri Oct 13 13:35:06 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/ejb/cmp3/persistence/PersistenceUnitProcessor.java Mon Oct 16 16:52:08 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.ejb.cmp3.persistence; import java.net.URL; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.ejb.cmp3.persistence; import java.net.URL; *************** *** 42,47 **** --- 42,48 ---- import oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException; import oracle.toplink.essentials.exceptions.XMLParseException; + import oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor; import oracle.toplink.essentials.internal.ejb.cmp3.xml.XMLConstants; import oracle.toplink.essentials.internal.ejb.cmp3.xml.parser.PersistenceContentHandler; import oracle.toplink.essentials.internal.ejb.cmp3.xml.parser.XMLException; *************** *** 166,172 **** * Build a set that contains all the class names at a URL * @return a Set of class name strings */ ! public static Set buildClassSet(PersistenceUnitInfo persistenceUnitInfo){ Set set = new HashSet(); set.addAll(persistenceUnitInfo.getManagedClassNames()); Iterator i = persistenceUnitInfo.getJarFileUrls().iterator(); --- 167,173 ---- * Build a set that contains all the class names at a URL * @return a Set of class name strings */ ! public static Set buildClassSet(PersistenceUnitInfo persistenceUnitInfo, ClassLoader loader){ Set set = new HashSet(); set.addAll(persistenceUnitInfo.getManagedClassNames()); Iterator i = persistenceUnitInfo.getJarFileUrls().iterator(); *************** *** 176,185 **** if (!persistenceUnitInfo.excludeUnlistedClasses()){ set.addAll(getClassNamesFromURL(persistenceUnitInfo.getPersistenceUnitRootUrl())); } ! return set; } /** * Search the classpath for persistence archives. A persistence archive is defined as any * part of the class path that contains a META-INF directory with a persistence.xml file in it. * Return a list of the URLs of those files. --- 177,205 ---- if (!persistenceUnitInfo.excludeUnlistedClasses()){ set.addAll(getClassNamesFromURL(persistenceUnitInfo.getPersistenceUnitRootUrl())); } ! set.addAll(buildPersistentClassSetFromXMLDocuments(persistenceUnitInfo, loader)); ! return set; } /** + * Return a Set of the classnames represented in the mapping files specified in info + * @param info + * @param loader + * @return + */ + private static Set buildPersistentClassSetFromXMLDocuments(PersistenceUnitInfo info, ClassLoader loader){ + Set classes = null; + + // Build a MetadataProcessor to search the mapped classes in orm xml documents + // We hand in a null session since none of the functionality required uses a session + MetadataProcessor processor = new MetadataProcessor(info, null, loader, false); + processor.readMappingFiles(false); + classes = processor.buildEntityClassSetFromXMLDocuments(); + + return classes; + } + + /** * Search the classpath for persistence archives. A persistence archive is defined as any * part of the class path that contains a META-INF directory with a persistence.xml file in it. * Return a list of the URLs of those files. ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/DescriptorException.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.11 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.11 Fri Oct 13 13:36:30 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/DescriptorException.java Mon Oct 16 16:52:08 2006 *************** *** 221,226 **** --- 221,227 ---- public final static int NEED_TO_IMPLEMENT_FETCHGROUPTRACKER = 199; public final static int ATTEMPT_TO_REGISTER_DEAD_INDIRECTION = 200; public final static int INTERNAL_ERROR_ACCESSING_PKFIELD = 201; + public final static int INTERNAL_ERROR_SET_METHOD = 202; /** * INTERNAL: *************** *** 1822,1825 **** --- 1823,1836 ---- JavaPlatform.setExceptionCause(exception, underlying); return exception; } + + public static DescriptorException errorAccessingSetMethodOfEntity(Class aClass, String methodName, ClassDescriptor descriptor, Exception underlying) { + Object[] args = { aClass, methodName }; + + DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INTERNAL_ERROR_SET_METHOD, args), descriptor, underlying); + JavaPlatform.setExceptionCause(exception, underlying); + return exception; + } + + } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/PersistenceUnitLoadingException.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.11 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.11 Fri Oct 13 13:36:34 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/PersistenceUnitLoadingException.java Mon Oct 16 16:52:08 2006 *************** *** 28,33 **** --- 28,35 ---- public class PersistenceUnitLoadingException extends TopLinkException { + private String resourceName = null; + public static final int EXCEPTION_LOADING_FROM_DIRECTORY = 30001; public static final int EXCEPTION_LOADING_FROM_JAR = 30002; public static final int EXCEPTION_PROCESSING_PERSISTENCE_UNIT = 30003; *************** *** 69,74 **** --- 71,77 ---- Object[] args = { directory }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_LOADING_FROM_DIRECTORY, args), cause); + loadingException.setResourceName(directory.toString()); loadingException.setErrorCode(EXCEPTION_LOADING_FROM_DIRECTORY); return loadingException; } *************** *** 77,82 **** --- 80,86 ---- Object[] args = { filePath }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, FILE_PATH_MISSING_EXCEPTION, args)); + loadingException.setResourceName(filePath); loadingException.setErrorCode(FILE_PATH_MISSING_EXCEPTION); return loadingException; } *************** *** 85,90 **** --- 89,95 ---- Object[] args = { jarFile }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_LOADING_FROM_JAR, args), cause); + loadingException.setResourceName(jarFile.toString()); loadingException.setErrorCode(EXCEPTION_LOADING_FROM_JAR); return loadingException; } *************** *** 93,98 **** --- 98,104 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_LOADING_FROM_URL, args), cause); + loadingException.setResourceName(url); loadingException.setErrorCode(EXCEPTION_LOADING_FROM_URL); return loadingException; } *************** *** 101,106 **** --- 107,113 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_PROCESSING_PERSISTENCE_UNIT, args), cause); + loadingException.setResourceName(url.toString()); loadingException.setErrorCode(EXCEPTION_PROCESSING_PERSISTENCE_UNIT); return loadingException; } *************** *** 109,114 **** --- 116,122 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_PROCESSING_PERSISTENCE_XML, args), cause); + loadingException.setResourceName(url.toString()); loadingException.setErrorCode(EXCEPTION_PROCESSING_PERSISTENCE_XML); return loadingException; } *************** *** 125,130 **** --- 133,139 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_SEARCHING_FOR_ENTITIES, args), cause); + loadingException.setResourceName(url.toString()); loadingException.setErrorCode(EXCEPTION_SEARCHING_FOR_ENTITIES); return loadingException; } *************** *** 141,146 **** --- 150,156 ---- Object[] args = { fileName }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_OPENING_ORM_XML, args), cause); + loadingException.setResourceName(fileName); loadingException.setErrorCode(EXCEPTION_OPENING_ORM_XML); return loadingException; } *************** *** 149,156 **** --- 159,175 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, COULD_NOT_GET_CLASS_NAMES_FROM_URL, args)); + loadingException.setResourceName(url.toString()); loadingException.setErrorCode(COULD_NOT_GET_CLASS_NAMES_FROM_URL); return loadingException; } + public String getResourceName(){ + return resourceName; + } + + public void setResourceName(String resourceName){ + this.resourceName = resourceName; + } + } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/i18n/DescriptorExceptionResource.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000005/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000005/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:36:34 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/i18n/DescriptorExceptionResource.java Mon Oct 16 16:52:08 2006 *************** *** 218,224 **** { "198", "In order to use ObjectChangeTrackingPolicy or AttributeChangeTrackingPolicy, {0} has to implement ChangeTracker interface." }, { "199", "In order to use Fetch Group, the domain class ({0}) has to implement FetchGroupTracker interface." }, { "200", "Attempt to register an object with dead indirection as a new object. Possibly the object was deleted or removed from the cache during a merge of a serialized clone. This is a concurrency violation, consider a locking strategy." }, ! { "201", "An internal error occurred accessing the primary key object [{0}]." } }; /** --- 218,226 ---- { "198", "In order to use ObjectChangeTrackingPolicy or AttributeChangeTrackingPolicy, {0} has to implement ChangeTracker interface." }, { "199", "In order to use Fetch Group, the domain class ({0}) has to implement FetchGroupTracker interface." }, { "200", "Attempt to register an object with dead indirection as a new object. Possibly the object was deleted or removed from the cache during a merge of a serialized clone. This is a concurrency violation, consider a locking strategy." }, ! { "201", "An internal error occurred accessing the primary key object [{0}]." }, ! { "202", "An internal error occurred while accessing method [{1}] on class [{0}]." } ! }; /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/indirection/ValueHolder.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000006/AB0952363AC40CBFE034080020E8C54E.4 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000006/AB0952363AC40CBFE034080020E8C54E.4 Fri Oct 13 13:41:57 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/indirection/ValueHolder.java Mon Oct 16 16:52:08 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.indirection; import java.io.Serializable; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.indirection; import java.io.Serializable; *************** *** 28,41 **** * Purpose: Act as a place holder for a variable that required a value holder interface. * This class should be used to initialze an objects attributes that are using indirection is their mappings. */ ! public class ValueHolder implements ValueHolderInterface, Cloneable, Serializable { ! /** * Stores the wrapped object. */ protected Object value; /** * PUBLIC: * Initialize the holder. */ --- 28,51 ---- * Purpose: Act as a place holder for a variable that required a value holder interface. * This class should be used to initialze an objects attributes that are using indirection is their mappings. */ ! public class ValueHolder implements WeavedAttributeValueHolderInterface, Cloneable, Serializable { ! /** * Stores the wrapped object. */ protected Object value; /** + * The two variable below are used as part of the implementation of WeavedAttributeValueHolderInterface + * They are used to track whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + */ + // Set internally in TopLink when the state of coordination between a weaved valueholder and the underlying property is known + private boolean isCoordinatedWithProperty = false; + // Used to determine if this ValueHolder was added instantiated as part of the constructor of a weaved class + private boolean isNewlyWeavedValueHolder = false; + + /** * PUBLIC: * Initialize the holder. */ *************** *** 73,78 **** --- 83,106 ---- } /** + * Used as part of the implementation of WeavedAttributeValueHolderInterface + * Used to track whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + */ + public boolean isCoordinatedWithProperty(){ + return isCoordinatedWithProperty; + } + + /** + * Used as part of the implementation of WeavedAttributeValueHolderInterface + * Used to determine if this ValueHolder was added instantiated as part of + * the constructor of a weaved class + */ + public boolean isNewlyWeavedValueHolder(){ + return isNewlyWeavedValueHolder; + } + + /** * PUBLIC: * Return a boolean indicating whether the * wrapped object has been set or not. *************** *** 84,89 **** --- 112,142 ---- } /** + * Used as part of the implementation of WeavedAttributeValueHolderInterface + * Used to track whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + * + * This method will be called internall when the state of Coordination between the + * weaved valueholder and the underlying value is known + */ + public void setIsCoordinatedWithProperty(boolean coordinated){ + this.isCoordinatedWithProperty = coordinated; + // this is not a newly weaved valueholder any more since we have done some coordination work + isNewlyWeavedValueHolder = false; + } + + /** + * Used as part of the implementation of WeavedAttributeValueHolderInterface + * Used to determine if this ValueHolder was added instantiated as part of + * the constructor of a weaved class + * + * This method will be called when a ValueHolder is instantiated in a weaved class + */ + public void setIsNewlyWeavedValueHolder(boolean isNew){ + this.isNewlyWeavedValueHolder = isNew; + } + + /** * PUBLIC: * Set the wrapped object. */ ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/indirection/WeavedAttributeValueHolderInterface.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000008/AB0952363AC40CBFE034080020E8C54E.0 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000008/AB0952363AC40CBFE034080020E8C54E.0 Mon Oct 16 16:49:00 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/indirection/WeavedAttributeValueHolderInterface.java Mon Oct 16 16:48:59 2006 *************** *** 0 **** --- 1,43 ---- + package oracle.toplink.essentials.indirection; + + /** + * INTERNAL: + * This interface defines funtionality required by ValueHolders for OneToOneMappings that + * have LAZY access weaved into them and use Property (method) based access + * + * The weaving feature adds a paralell valueholder to the class it weaves and uses that valueholder + * to control the lazy loading. The methods on this interface provide information about how that weaved + * valueholder is related to the underlying value. + * @author tware + * + */ + public interface WeavedAttributeValueHolderInterface extends ValueHolderInterface { + + /** + * When a valueholder is triggered, the weaved code will ensure its value is + * coordinated with the underlying property. This method allows TopLink to determine + * if that has happened. + * @return + */ + public boolean isCoordinatedWithProperty(); + + /** + * TopLink will call this method when the triggering of a weaved valueholder causes it's + * value to be coordinated with the underlying property + */ + public void setIsCoordinatedWithProperty(boolean coordinated); + + /** + * This method returns whether this valueholder has been newly instantiated by weaved code. + * @return + */ + public boolean isNewlyWeavedValueHolder(); + + /** + * TopLink weaving calls this method on any valueholder it weaves into a class to indicate + * that it is new and it's value should not be considered. The method is also called when coordination + * with the underlying value occurs to indicate the value can now be trusted. + * @param isNew + */ + public void setIsNewlyWeavedValueHolder(boolean isNew); + } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/mappings/ForeignReferenceMapping.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000009/AB0952363AC40CBFE034080020E8C54E.24 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000009/AB0952363AC40CBFE034080020E8C54E.24 Fri Oct 13 13:49:02 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/mappings/ForeignReferenceMapping.java Mon Oct 16 16:52:08 2006 *************** *** 321,326 **** --- 321,342 ---- } return attributeValue; } + + /** + * INTERNAL: + * Returns the attribute value from the reference object. + * If the attribute is using indirection the value of the value-holder is returned. + * If the value holder is not instantiated then it is instantiated. + */ + public Object getAttributeValueWithClonedValueHolders(Object object) { + Object attributeValue = getAttributeValueFromObject(object); + if (attributeValue instanceof DatabaseValueHolder){ + return ((DatabaseValueHolder)attributeValue).clone(); + } else if (attributeValue instanceof ValueHolder){ + return ((ValueHolder)attributeValue).clone(); + } + return attributeValue; + } /** * INTERNAL: *************** *** 347,353 **** * If the value holder is not instantiated then it is instantiated. */ public Object getRealAttributeValueFromObject(Object object, AbstractSession session) { ! return getIndirectionPolicy().getRealAttributeValueFromObject(getAttributeValueFromObject(object)); } /** --- 363,369 ---- * If the value holder is not instantiated then it is instantiated. */ public Object getRealAttributeValueFromObject(Object object, AbstractSession session) { ! return getIndirectionPolicy().getRealAttributeValueFromObject(object, getAttributeValueFromObject(object)); } /** *************** *** 814,820 **** return query.shouldCascadeAllParts(); } ! /** * PUBLIC: * Indirection means that a ValueHolder will be put in-between the attribute and the real object. --- 830,836 ---- return query.shouldCascadeAllParts(); } ! /** * PUBLIC: * Indirection means that a ValueHolder will be put in-between the attribute and the real object. *************** *** 825,830 **** --- 841,850 ---- setIndirectionPolicy(new BasicIndirectionPolicy()); } + public void useWeavedIndirection(String setMethodName){ + setIndirectionPolicy(new WeavedObjectBasicIndirectionPolicy(setMethodName)); + } + /** * PUBLIC: * Indirection means that some sort of indirection object will be put in-between the attribute and the real object. ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/mappings/ObjectReferenceMapping.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000010/AB0952363AC40CBFE034080020E8C54E.7 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000010/AB0952363AC40CBFE034080020E8C54E.7 Fri Oct 13 13:49:06 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/mappings/ObjectReferenceMapping.java Mon Oct 16 16:52:08 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.mappings; import java.util.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.mappings; import java.util.*; *************** *** 634,640 **** public void cascadePerformRemoveIfRequired(Object object, UnitOfWorkImpl uow, IdentityHashtable visitedObjects){ Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.isCascadeRemove() ){ ! Object reference = getIndirectionPolicy().getRealAttributeValueFromObject(attributeValue); if (reference != null && (! visitedObjects.contains(reference)) ){ visitedObjects.put(reference, reference); uow.performRemove(reference, visitedObjects); --- 634,640 ---- public void cascadePerformRemoveIfRequired(Object object, UnitOfWorkImpl uow, IdentityHashtable visitedObjects){ Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.isCascadeRemove() ){ ! Object reference = getIndirectionPolicy().getRealAttributeValueFromObject(object, attributeValue); if (reference != null && (! visitedObjects.contains(reference)) ){ visitedObjects.put(reference, reference); uow.performRemove(reference, visitedObjects); *************** *** 649,655 **** public void cascadeRegisterNewIfRequired(Object object, UnitOfWorkImpl uow, IdentityHashtable visitedObjects){ Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.isCascadePersist() && getIndirectionPolicy().objectIsInstantiated(attributeValue)){ ! Object reference = getIndirectionPolicy().getRealAttributeValueFromObject(attributeValue); if (reference != null && (! visitedObjects.contains(reference)) ){ visitedObjects.put(reference, reference); uow.registerNewObjectForPersist(reference, visitedObjects); --- 649,655 ---- public void cascadeRegisterNewIfRequired(Object object, UnitOfWorkImpl uow, IdentityHashtable visitedObjects){ Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.isCascadePersist() && getIndirectionPolicy().objectIsInstantiated(attributeValue)){ ! Object reference = getIndirectionPolicy().getRealAttributeValueFromObject(object, attributeValue); if (reference != null && (! visitedObjects.contains(reference)) ){ visitedObjects.put(reference, reference); uow.registerNewObjectForPersist(reference, visitedObjects); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/descriptors/ObjectBuilder.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000011/AB0952363AC40CBFE034080020E8C54E.27 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000011/AB0952363AC40CBFE034080020E8C54E.27 Fri Oct 13 13:52:53 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/descriptors/ObjectBuilder.java Mon Oct 16 16:52:08 2006 *************** *** 1290,1303 **** /** * Copy each attribute from one object into the other. */ ! public void copyInto(Object source, Object target) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. Vector mappings = getDescriptor().getMappings(); for (int index = 0; index < mappings.size(); index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); ! mapping.setAttributeValueInObject(target, mapping.getAttributeValueFromObject(source)); } } /** * Return a copy of the object. --- 1290,1317 ---- /** * Copy each attribute from one object into the other. */ ! public void copyInto(Object source, Object target, boolean cloneOneToOneValueHolders) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. Vector mappings = getDescriptor().getMappings(); for (int index = 0; index < mappings.size(); index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); ! Object value = null; ! if (cloneOneToOneValueHolders && mapping.isForeignReferenceMapping()){ ! value = ((ForeignReferenceMapping)mapping).getAttributeValueWithClonedValueHolders(source); ! } else { ! value = mapping.getAttributeValueFromObject(source); ! } ! mapping.setAttributeValueInObject(target, value); } } + + /** + * Copy each attribute from one object into the other. + */ + public void copyInto(Object source, Object target) { + copyInto(source, target, false); + } + /** * Return a copy of the object. ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/weaving/TopLinkClassWeaver.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000012/AB0952363AC40CBFE034080020E8C54E.10 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000012/AB0952363AC40CBFE034080020E8C54E.10 Fri Oct 13 13:53:13 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/weaving/TopLinkClassWeaver.java Mon Oct 16 16:52:08 2006 *************** *** 41,51 **** public class TopLinkClassWeaver extends ClassAdapter implements Constants { public static final String VHI_CLASSNAME = ! "oracle.toplink.essentials.indirection.ValueHolderInterface"; public static final String VH_SHORT_SIGNATURE = "oracle/toplink/essentials/indirection/ValueHolder"; public static final String VHI_SHORT_SIGNATURE = ! "oracle/toplink/essentials/indirection/ValueHolderInterface"; public static final String VHI_SIGNATURE = "L" + VHI_SHORT_SIGNATURE +";"; public static final String TW_SHORT_SIGNATURE = --- 41,51 ---- public class TopLinkClassWeaver extends ClassAdapter implements Constants { public static final String VHI_CLASSNAME = ! "oracle.toplink.essentials.indirection.WeavedAttributeValueHolderInterface"; public static final String VH_SHORT_SIGNATURE = "oracle/toplink/essentials/indirection/ValueHolder"; public static final String VHI_SHORT_SIGNATURE = ! "oracle/toplink/essentials/indirection/WeavedAttributeValueHolderInterface"; public static final String VHI_SIGNATURE = "L" + VHI_SHORT_SIGNATURE +";"; public static final String TW_SHORT_SIGNATURE = *************** *** 74,89 **** annotations = getTransientAnnotation(); } weavedVH = true; ! cv.visitField(ACC_PRIVATE, "_toplink_" + attribute + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;", null, annotations); } /** * INTERNAL: ! * Add a get method for the newly added valueholder. Adds a method of the followign form: * ! * public ValueHolderInterface _toplink_getvariableName_vh(){ ! * return _toplink_variableName_vh; ! * } */ public void addGetterMethodForValueHolder(ClassDetails classDetails, AttributeDetails attributeDetails){ String attribute = attributeDetails.getAttributeName(); --- 74,95 ---- annotations = getTransientAnnotation(); } weavedVH = true; ! cv.visitField(ACC_PRIVATE, "_toplink_" + attribute + "_vh", VHI_SIGNATURE, null, annotations); } /** * INTERNAL: ! * Add a get method for the newly added valueholder. Adds a method of the following form: * ! * public WeavedAttributeValueHolderInterface _toplink_getfoo_vh(){ ! * if (_toplink_foo_vh.isCoordinatedWithProperty() || _toplink_foo_vh.isNewlyWeavedValueHolder()){ ! * EntityC object = getFoo(); ! * if (object != _toplink_foo_vh.getValue()){ ! * setFoo(object); ! * } ! * } ! * return _toplink_foo_vh; ! * } */ public void addGetterMethodForValueHolder(ClassDetails classDetails, AttributeDetails attributeDetails){ String attribute = attributeDetails.getAttributeName(); *************** *** 91,98 **** // Create a getter method for the new valueholder CodeVisitor cv_get_VH = cv.visitMethod(ACC_PUBLIC, "_toplink_get" + attribute + "_vh", "()" + VHI_SIGNATURE, null, null); cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitFieldInsn(GETFIELD, className, "_toplink_" + attribute + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;"); cv_get_VH.visitInsn(ARETURN); cv_get_VH.visitMaxs(0, 0); } --- 97,140 ---- // Create a getter method for the new valueholder CodeVisitor cv_get_VH = cv.visitMethod(ACC_PUBLIC, "_toplink_get" + attribute + "_vh", "()" + VHI_SIGNATURE, null, null); cv_get_VH.visitVarInsn(ALOAD, 0); ! ! // if (_toplink_foo_vh.isCoordinatedWithProperty() || _toplink_foo_vh.isNewlyWeavedValueHolder()){ ! cv_get_VH.visitFieldInsn(GETFIELD, classDetails.getClassName(), "_toplink_" + attribute + "_vh", VHI_SIGNATURE); ! cv_get_VH.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "isCoordinatedWithProperty", "()Z"); ! Label l0 = new Label(); ! cv_get_VH.visitJumpInsn(IFNE, l0); ! cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitFieldInsn(GETFIELD, classDetails.getClassName(), "_toplink_" + attribute + "_vh", VHI_SIGNATURE); ! cv_get_VH.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "isNewlyWeavedValueHolder", "()Z"); ! Label l1 = new Label(); ! cv_get_VH.visitJumpInsn(IFEQ, l1); ! cv_get_VH.visitLabel(l0); ! cv_get_VH.visitVarInsn(ALOAD, 0); ! ! // EntityC object = getFoo(); ! cv_get_VH.visitMethodInsn(INVOKEVIRTUAL, classDetails.getClassName(), attributeDetails.getGetterMethodName(), "()L" + attributeDetails.getReferenceClass().replace('.','/') + ";"); ! cv_get_VH.visitVarInsn(ASTORE, 1); ! ! // if (object != _toplink_foo_vh.getValue()){ ! cv_get_VH.visitVarInsn(ALOAD, 1); ! cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitFieldInsn(GETFIELD, classDetails.getClassName(), "_toplink_" + attribute + "_vh", VHI_SIGNATURE); ! cv_get_VH.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "getValue", "()Ljava/lang/Object;"); ! cv_get_VH.visitJumpInsn(IF_ACMPEQ, l1); ! ! // setFoo(object); ! cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitVarInsn(ALOAD, 1); ! cv_get_VH.visitMethodInsn(INVOKEVIRTUAL, classDetails.getClassName(), attributeDetails.getSetterMethodName(), "(L" + attributeDetails.getReferenceClass().replace('.','/') + ";)V"); ! ! // } ! cv_get_VH.visitLabel(l1); ! ! // return _toplink_foo_vh; ! cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitFieldInsn(GETFIELD, className, "_toplink_" + attribute + "_vh", VHI_SIGNATURE); cv_get_VH.visitInsn(ARETURN); + cv_get_VH.visitMaxs(0, 0); } *************** *** 100,119 **** * INTERNAL: * Add a set method for the newly added ValueHolder. Adds a method of this form: * ! * public void _toplink_setvariableName_vh(ValueHolderInterface valueholderinterface) ! * _toplink_variableName_vh = valueholderinterface; ! * } */ public void addSetterMethodForValueHolder(ClassDetails classDetails, AttributeDetails attributeDetails){ String attribute = attributeDetails.getAttributeName(); String className = classDetails.getClassName(); // create a setter method for the new valueholder ! CodeVisitor cv_set_value = cv.visitMethod(ACC_PUBLIC, "_toplink_set" + attribute + "_vh", "(Loracle/toplink/essentials/indirection/ValueHolderInterface;)V", null, null); cv_set_value.visitVarInsn(ALOAD, 0); cv_set_value.visitVarInsn(ALOAD, 1); ! cv_set_value.visitFieldInsn(PUTFIELD, className, "_toplink_" + attribute + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;"); cv_set_value.visitInsn(RETURN); cv_set_value.visitMaxs(0, 0); } /** --- 142,203 ---- * INTERNAL: * Add a set method for the newly added ValueHolder. Adds a method of this form: * ! * public void _toplink_setfoo_vh(WeavedAttributeValueHolderInterface valueholderinterface){ ! * _toplink_foo_vh = valueholderinterface; ! * if (valueholderinterface.isInstantiated()){ ! * Object object = getFoo(); ! * Object value = valueholderinterface.getValue(); ! * if (object != value){ ! * setFoo((EntityC)value); ! * } ! * } ! * } */ public void addSetterMethodForValueHolder(ClassDetails classDetails, AttributeDetails attributeDetails){ String attribute = attributeDetails.getAttributeName(); String className = classDetails.getClassName(); // create a setter method for the new valueholder ! CodeVisitor cv_set_value = cv.visitMethod(ACC_PUBLIC, "_toplink_set" + attribute + "_vh", "(" + VHI_SIGNATURE + ")V", null, null); ! ! // _toplink_foo_vh = valueholderinterface; cv_set_value.visitVarInsn(ALOAD, 0); cv_set_value.visitVarInsn(ALOAD, 1); ! cv_set_value.visitFieldInsn(PUTFIELD, className, "_toplink_" + attribute + "_vh", VHI_SIGNATURE); ! ! // if (valueholderinterface.isInstantiated()){ ! cv_set_value.visitVarInsn(ALOAD, 1); ! cv_set_value.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "isInstantiated", "()Z"); ! Label l0 = new Label(); ! cv_set_value.visitJumpInsn(IFEQ, l0); ! ! // Object object = getFoo(); ! cv_set_value.visitVarInsn(ALOAD, 0); ! cv_set_value.visitMethodInsn(INVOKEVIRTUAL, className, attributeDetails.getGetterMethodName(), "()L" + attributeDetails.getReferenceClass().replace('.','/') + ";"); ! cv_set_value.visitVarInsn(ASTORE, 2); ! ! // Object value = valueholderinterface.getValue(); ! cv_set_value.visitVarInsn(ALOAD, 1); ! cv_set_value.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "getValue", "()Ljava/lang/Object;"); ! cv_set_value.visitVarInsn(ASTORE, 3); ! ! // if (object != value){ ! cv_set_value.visitVarInsn(ALOAD, 2); ! cv_set_value.visitVarInsn(ALOAD, 3); ! cv_set_value.visitJumpInsn(IF_ACMPEQ, l0); ! ! // setFoo((EntityC)value); ! cv_set_value.visitVarInsn(ALOAD, 0); ! cv_set_value.visitVarInsn(ALOAD, 3); ! cv_set_value.visitTypeInsn(CHECKCAST, attributeDetails.getReferenceClass().replace('.','/')); ! cv_set_value.visitMethodInsn(INVOKEVIRTUAL, className, attributeDetails.getSetterMethodName(), "(L" + attributeDetails.getReferenceClass().replace('.','/') + ";)V"); ! ! // } ! cv_set_value.visitLabel(l0); ! ! cv_set_value.visitInsn(RETURN); cv_set_value.visitMaxs(0, 0); + } /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/weaving/TopLinkMethodWeaver.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000013/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000013/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:53:13 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/weaving/TopLinkMethodWeaver.java Mon Oct 16 16:52:08 2006 *************** *** 103,108 **** --- 103,109 ---- * has been added, the following line will be added to the constructor. * * _toplink_variableName_vh = new ValueHolder(); + * _toplink_foo_vh.setIsNewlyWeavedValueHolder(true); */ public void weaveConstructorIfRequired(int opcode, String owner, String name, String desc){ if (!constructorInitializationDone && ("".equals(methodName)||"".equals(methodName))) { *************** *** 117,126 **** AttributeDetails attribute = (AttributeDetails)details.getAttributesMap().get(key); if (attribute.weaveValueHolders() && !attribute.isCollectionMapping() && !attribute.isAttributeOnSuperClass()){ super.visitVarInsn(ALOAD, 0); ! super.visitTypeInsn(NEW, "oracle/toplink/essentials/indirection/ValueHolder"); super.visitInsn(DUP); ! super.visitMethodInsn(INVOKESPECIAL, "oracle/toplink/essentials/indirection/ValueHolder", "", "()V"); ! super.visitFieldInsn(PUTFIELD, details.className, "_toplink_" + attribute.attributeName + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;"); } } } --- 118,132 ---- AttributeDetails attribute = (AttributeDetails)details.getAttributesMap().get(key); if (attribute.weaveValueHolders() && !attribute.isCollectionMapping() && !attribute.isAttributeOnSuperClass()){ super.visitVarInsn(ALOAD, 0); ! super.visitTypeInsn(NEW, TopLinkClassWeaver.VH_SHORT_SIGNATURE); super.visitInsn(DUP); ! super.visitMethodInsn(INVOKESPECIAL, TopLinkClassWeaver.VH_SHORT_SIGNATURE, "", "()V"); ! super.visitFieldInsn(PUTFIELD, details.className, "_toplink_" + attribute.attributeName + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); ! ! super.visitVarInsn(ALOAD, 0); ! super.visitFieldInsn(GETFIELD, details.className, "_toplink_" + attribute.attributeName + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); ! super.visitInsn(ICONST_1); ! super.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "setIsNewlyWeavedValueHolder", "(Z)V"); } } } *************** *** 134,144 **** * * In a getter method for 'attributeName', the following line is added at the beginning of the method * ! * setAttributeName((<AttributeClass>)_toplink_attributeName_vh.getValue()); * * In a setter method, for 'attributeName', the following line is added at the beginning of the method * ! * _toplink_attributeName_vh.setValue(methodArgument); * * TODO: In the end, the call to setValue() should be modified to somehow make use of the result of * the getter method. This behavior has not yet been implemented. --- 140,153 ---- * * In a getter method for 'attributeName', the following line is added at the beginning of the method * ! * if (!_toplink_attributeName_vh.isInstantiated()){ ! * setFoo((EntityC)_toplink_attributeName_vh.getValue()); ! * } * * In a setter method, for 'attributeName', the following line is added at the beginning of the method * ! * _toplink_attributeName_vh.setValue(argument); ! * _toplink_attributeName_vh.setIsCoordinatedWithProperty(true); * * TODO: In the end, the call to setValue() should be modified to somehow make use of the result of * the getter method. This behavior has not yet been implemented. *************** *** 149,167 **** } AttributeDetails attributeDetails = (AttributeDetails)tcw.classDetails.getGetterMethodToAttributeDetails().get(methodName); if (attributeDetails != null && !attributeDetails.isAttributeOnSuperClass()){ cv.visitVarInsn(ALOAD, 0); cv.visitVarInsn(ALOAD, 0); cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "getValue", "()Ljava/lang/Object;"); cv.visitTypeInsn(CHECKCAST, attributeDetails.getReferenceClass().replace('.','/')); cv.visitMethodInsn(INVOKEVIRTUAL, tcw.classDetails.getClassName(), attributeDetails.getSetterMethodName(), "(L" + attributeDetails.getReferenceClass().replace('.','/') + ";)V"); } else { attributeDetails = (AttributeDetails)tcw.classDetails.getSetterMethodToAttributeDetails().get(methodName); if (attributeDetails != null){ cv.visitVarInsn(ALOAD, 0); ! cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;"); cv.visitVarInsn(ALOAD, 1); cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "setValue", "(Ljava/lang/Object;)V"); } } } --- 158,195 ---- } AttributeDetails attributeDetails = (AttributeDetails)tcw.classDetails.getGetterMethodToAttributeDetails().get(methodName); if (attributeDetails != null && !attributeDetails.isAttributeOnSuperClass()){ + + cv.visitVarInsn(ALOAD, 0); + cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); + cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "isInstantiated", "()Z"); + Label l0 = new Label(); + cv.visitJumpInsn(IFNE, l0); + + cv.visitVarInsn(ALOAD, 0); cv.visitVarInsn(ALOAD, 0); cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "getValue", "()Ljava/lang/Object;"); cv.visitTypeInsn(CHECKCAST, attributeDetails.getReferenceClass().replace('.','/')); cv.visitMethodInsn(INVOKEVIRTUAL, tcw.classDetails.getClassName(), attributeDetails.getSetterMethodName(), "(L" + attributeDetails.getReferenceClass().replace('.','/') + ";)V"); + + cv.visitLabel(l0); + //cv.visitVarInsn(ALOAD, 0); + // cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "foo", "L" + attributeDetails.getReferenceClass().replace('.','/') + ";"); + + } else { attributeDetails = (AttributeDetails)tcw.classDetails.getSetterMethodToAttributeDetails().get(methodName); if (attributeDetails != null){ cv.visitVarInsn(ALOAD, 0); ! cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); cv.visitVarInsn(ALOAD, 1); cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "setValue", "(Ljava/lang/Object;)V"); + + cv.visitVarInsn(ALOAD, 0); + cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); + cv.visitInsn(ICONST_1); + cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "setIsCoordinatedWithProperty", "(Z)V"); } } } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/localization/i18n/TraceLocalizationResource.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000014/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000014/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:55:04 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/localization/i18n/TraceLocalizationResource.java Mon Oct 16 16:52:08 2006 *************** *** 255,261 **** { "cmp_init_globalInstrumentation_is_null", "javaSECMPInitializer - global instrumentation is null."}, { "cmp_init_invoke_deploy", "javaSECMPInitializer - deploying {0}."}, { "cmp_init_completed_deploy", "javaSECMPInitializer - completed deploy of {0}."}, ! { "cmp_init_initialize", "javaSECMPInitializer - initializaing {0}."}, { "cmp_init_initialize_from_main", "javaSECMPInitializer - initializing from main."}, { "dbPlaformHelper_detectedVendorPlatform", "Detected Vendor platform: {0}"}, --- 255,261 ---- { "cmp_init_globalInstrumentation_is_null", "javaSECMPInitializer - global instrumentation is null."}, { "cmp_init_invoke_deploy", "javaSECMPInitializer - deploying {0}."}, { "cmp_init_completed_deploy", "javaSECMPInitializer - completed deploy of {0}."}, ! { "cmp_init_initialize", "javaSECMPInitializer - initializing {0}."}, { "cmp_init_initialize_from_main", "javaSECMPInitializer - initializing from main."}, { "dbPlaformHelper_detectedVendorPlatform", "Detected Vendor platform: {0}"}, ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/BasicIndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000015/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000015/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:57:00 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/BasicIndirectionPolicy.java Mon Oct 16 16:52:08 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.util.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.util.*; *************** *** 163,180 **** return unitOfWorkIndirectionObject; } } ! /** * INTERNAL: * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object) { // Changed for CR 4245. Use a static reference instead of .class ! if (ClassConstants.ValueHolderInterface_Class.isAssignableFrom(object.getClass())) { ! return ((ValueHolderInterface)object).getValue(); } else { ! return object; } } --- 163,180 ---- return unitOfWorkIndirectionObject; } } ! /** * INTERNAL: * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object, Object attribute) { // Changed for CR 4245. Use a static reference instead of .class ! if (ClassConstants.ValueHolderInterface_Class.isAssignableFrom(attribute.getClass())) { ! return ((ValueHolderInterface)attribute).getValue(); } else { ! return attribute; } } *************** *** 215,224 **** if (holder == null) { holder = new ValueHolder(attributeValue); } else { ! holder.setValue(attributeValue); } super.setRealAttributeValueInObject(target, holder); } /** * INTERNAL: --- 215,225 ---- if (holder == null) { holder = new ValueHolder(attributeValue); } else { ! holder.setValue(attributeValue); } super.setRealAttributeValueInObject(target, holder); } + /** * INTERNAL: *************** *** 226,232 **** * In this case, the attribute type MUST be ValueHolderInterface. */ protected boolean typeIsValid(Class attributeType) { ! return attributeType == ClassConstants.ValueHolderInterface_Class; } /** --- 227,234 ---- * In this case, the attribute type MUST be ValueHolderInterface. */ protected boolean typeIsValid(Class attributeType) { ! return attributeType == ClassConstants.ValueHolderInterface_Class || ! attributeType == ClassConstants.WeavedAttributeValueHolderInterface_Class; } /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/DatabaseValueHolder.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000016/AB0952363AC40CBFE034080020E8C54E.5 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000016/AB0952363AC40CBFE034080020E8C54E.5 Fri Oct 13 13:57:03 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/DatabaseValueHolder.java Mon Oct 16 16:52:08 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.io.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.io.*; *************** *** 37,43 **** * @see ValueHolderInterface * @author Dorin Sandu */ ! public abstract class DatabaseValueHolder implements ValueHolderInterface, Cloneable, Serializable { /** Stores the object after it is read from the database. */ protected Object value; --- 37,43 ---- * @see ValueHolderInterface * @author Dorin Sandu */ ! public abstract class DatabaseValueHolder implements WeavedAttributeValueHolderInterface, Cloneable, Serializable { /** Stores the object after it is read from the database. */ protected Object value; *************** *** 50,55 **** --- 50,63 ---- /** Stores the row representation of the object. */ protected AbstractRecord row; + + /** + * The variable below is used as part of the implementation of WeavedAttributeValueHolderInterface + * It is used to track whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + * Set internally in TopLink when the state of coordination between a weaved valueholder and the underlying property is known + */ + protected boolean isCoordinatedWithProperty = false; public Object clone() { try { *************** *** 106,111 **** --- 114,138 ---- public abstract Object instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder unitOfWorkValueHolder); /** + * This method is used as part of the implementation of WeavedAttributeValueHolderInterface + * It is used to check whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + */ + public boolean isCoordinatedWithProperty(){ + return isCoordinatedWithProperty; + } + + /** + * This method is used as part of the implementation of WeavedAttributeValueHolderInterface. + * + * A DatabaseValueHolder is set up by TopLink and will never be a newly weaved valueholder. + * As a result, this method is stubbed out. + */ + public boolean isNewlyWeavedValueHolder(){ + return false; + } + + /** * INTERNAL: * Answers if this valueholder is easy to instantiate. * @return true if getValue() won't trigger a database read. *************** *** 161,166 **** --- 188,194 ---- */ public void privilegedSetValue(Object value) { this.value = value; + isCoordinatedWithProperty = false; } /** *************** *** 186,193 **** --- 214,239 ---- setRow(null); setSession(null); } + + /** + * This method is used as part of the implementation of WeavedAttributeValueHolderInterface + * It is used internally by TopLink to set whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + */ + public void setIsCoordinatedWithProperty(boolean coordinated){ + this.isCoordinatedWithProperty = coordinated; + } /** + * This method is used as part of the implementation of WeavedAttributeValueHolderInterface + * + * A DatabaseValueHolder is set up by TopLink and will never be a newly weaved valueholder + * As a result, this method is stubbed out. + */ + public void setIsNewlyWeavedValueHolder(boolean isNew){ + } + + /** * Set the instantiated flag to true. */ public void setInstantiated() { ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/IndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000017/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000017/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:57:03 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/IndirectionPolicy.java Mon Oct 16 16:52:08 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.io.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.io.*; *************** *** 179,185 **** * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public abstract Object getRealAttributeValueFromObject(Object object); /** * INTERNAL: --- 179,185 ---- * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public abstract Object getRealAttributeValueFromObject(Object object, Object attribute); /** * INTERNAL: ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/NoIndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000018/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000018/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:57:03 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/NoIndirectionPolicy.java Mon Oct 16 16:52:08 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import oracle.toplink.essentials.queryframework.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import oracle.toplink.essentials.queryframework.*; *************** *** 101,108 **** * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object) { ! return object; } /** --- 101,108 ---- * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object, Object attribute) { ! return attribute; } /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/TransparentIndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000019/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000019/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:57:03 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/TransparentIndirectionPolicy.java Mon Oct 16 16:52:08 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.util.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.util.*; *************** *** 248,256 **** * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object) { ! this.getContainerPolicy().sizeFor(object);// forgive me for this hack: but we have to do something to trigger the database read ! return object; } /** --- 248,256 ---- * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object, Object attribute) { ! this.getContainerPolicy().sizeFor(attribute);// forgive me for this hack: but we have to do something to trigger the database read ! return attribute; } /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/WeavedObjectBasicIndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000021/AB0952363AC40CBFE034080020E8C54E.0 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000021/AB0952363AC40CBFE034080020E8C54E.0 Mon Oct 16 16:49:22 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/WeavedObjectBasicIndirectionPolicy.java Mon Oct 16 16:49:21 2006 *************** *** 0 **** --- 1,123 ---- + package oracle.toplink.essentials.internal.indirection; + + import oracle.toplink.essentials.exceptions.DescriptorException; + import oracle.toplink.essentials.indirection.ValueHolder; + import oracle.toplink.essentials.indirection.ValueHolderInterface; + import oracle.toplink.essentials.indirection.WeavedAttributeValueHolderInterface; + import oracle.toplink.essentials.internal.helper.ClassConstants; + import oracle.toplink.essentials.internal.helper.ConversionManager; + import oracle.toplink.essentials.internal.helper.Helper; + import oracle.toplink.essentials.internal.security.PrivilegedAccessHelper; + import oracle.toplink.essentials.internal.security.PrivilegedMethodInvoker; + import oracle.toplink.essentials.internal.sessions.AbstractRecord; + import oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl; + import oracle.toplink.essentials.mappings.DatabaseMapping; + import oracle.toplink.essentials.mappings.ForeignReferenceMapping; + + import java.lang.reflect.InvocationTargetException; + import java.lang.reflect.Method; + import java.security.AccessController; + import java.security.PrivilegedActionException; + + /** + * INTERNAL: + * A WeavedObjectBasicIndirectionPolicy is used by OneToOne mappings that are LAZY through weaving + * and which use Property(method) access. + * + * It extends BasicIndirection by providing the capability of calling the set method that was initially + * mapped in addition to the set method for the weaved valueholder in order to coordinate the value of the + * underlying property with the value stored in the valueholder + * + * @author Tom Ware + * + */ + public class WeavedObjectBasicIndirectionPolicy extends BasicIndirectionPolicy { + + protected String setMethodName = null; // name of the initial set method. + protected Method setMethod = null; // lazily initialized set method based on the set method name + + public WeavedObjectBasicIndirectionPolicy(String setMethodName) { + super(); + this.setMethodName = setMethodName; + } + + /** + * INTERNAL: + * Return the "real" attribute value, as opposed to any wrapper. + * This will trigger the wrapper to instantiate the value. In a weaved policy, this will + * also call the initial setter method to coordinate the values of the valueholder with + * the underlying data + * + */ + public Object getRealAttributeValueFromObject(Object object, Object attribute) { + Object value = super.getRealAttributeValueFromObject(object, attribute); + // Provide the indirection policy with a callback that allows it to do any updates it needs as the result of getting the value + updateValueInObject(object, value, attribute); + return value; + } + + /** + * This method will lazily initialize the set method + * Lazy initialization occurs to that we are not required to have a handle on + * the actual class that we are using until runtime. This helps to satisfy the + * weaving requirement that demands that we avoid loading domain classes into + * the main class loader until after weaving occurs. + * @return + */ + protected Method getSetMethod(){ + if (setMethod == null){ + ForeignReferenceMapping sourceMapping = (ForeignReferenceMapping)mapping; + // The parameter type for the set method must always be the return type of the get method. + Class[] parameterTypes = new Class[1]; + parameterTypes[0] = sourceMapping.getReferenceClass(); + try { + setMethod = Helper.getDeclaredMethod(sourceMapping.getDescriptor().getJavaClass(), setMethodName, parameterTypes); + } catch (NoSuchMethodException e){ + throw DescriptorException.errorAccessingSetMethodOfEntity(sourceMapping.getDescriptor().getJavaClass(), setMethodName ,sourceMapping.getDescriptor(), e); + } + } + return setMethod; + } + + + /** + * Coordinate the valueholder for this mapping with the underlying property by calling the + * initial setter method + */ + public void updateValueInObject(Object object, Object value, Object attributeValue){ + setRealAttributeValueInObject(object, value); + ((WeavedAttributeValueHolderInterface)attributeValue).setIsCoordinatedWithProperty(true); + } + + /** + * INTERNAL: + * Set the value of the appropriate attribute of target to attributeValue. + * In this case, place the value inside the target's ValueHolder. + */ + public void setRealAttributeValueInObject(Object target, Object attributeValue) { + Object[] parameters = new Object[1]; + parameters[0] = attributeValue; + try { + if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){ + try { + AccessController.doPrivileged(new PrivilegedMethodInvoker(getSetMethod(), target, parameters)); + } catch (PrivilegedActionException exception) { + Exception throwableException = exception.getException(); + if (throwableException instanceof IllegalAccessException) { + throw DescriptorException.illegalAccessWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, throwableException); + } else { + throw DescriptorException.targetInvocationWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, throwableException); + } + } + } else { + PrivilegedAccessHelper.invokeMethod(getSetMethod(), target, parameters); + } + } catch (IllegalAccessException exception) { + throw DescriptorException.illegalAccessWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, exception); + } catch (IllegalArgumentException exception) { + throw DescriptorException.illegalArgumentWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, exception); + } catch (InvocationTargetException exception) { + throw DescriptorException.targetInvocationWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, exception); + } + } + } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/helper/ClassConstants.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000022/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000022/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 14:03:51 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/helper/ClassConstants.java Mon Oct 16 16:52:08 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.helper; import java.util.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.helper; import java.util.*; *************** *** 66,71 **** --- 66,72 ---- public static final Class ServerSession_Class = oracle.toplink.essentials.threetier.ServerSession.class; public static final Class SessionsSession_Class = oracle.toplink.essentials.sessions.Session.class; public static final Class ValueHolderInterface_Class = oracle.toplink.essentials.indirection.ValueHolderInterface.class; + public static final Class WeavedAttributeValueHolderInterface_Class = oracle.toplink.essentials.indirection.WeavedAttributeValueHolderInterface.class; // Identity map classes public static final Class CacheIdentityMap_Class = oracle.toplink.essentials.internal.identitymaps.CacheIdentityMap.class; ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializer.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000023/AB0952363AC40CBFE034080020E8C54E.25 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000023/AB0952363AC40CBFE034080020E8C54E.25 Fri Oct 13 14:06:05 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializer.java Mon Oct 16 16:52:08 2006 *************** *** 121,127 **** // we will only attempt to deploy when TopLink is specified as the provider or the provider is unspecified String providerClassName = persistenceUnitInfo.getPersistenceProviderClassName(); if (providerClassName == null || providerClassName.equals("") || providerClassName.equals(EntityManagerFactoryProvider.class.getName()) || providerClassName.equals(PersistenceProvider.class.getName())){ ! Set tempLoaderSet = PersistenceUnitProcessor.buildClassSet(persistenceUnitInfo); // Create the temp loader that will not cache classes for entities in our persistence unit ClassLoader tempLoader = createTempLoader(tempLoaderSet); persistenceUnitInfo.setNewTempClassLoader(tempLoader); --- 121,127 ---- // we will only attempt to deploy when TopLink is specified as the provider or the provider is unspecified String providerClassName = persistenceUnitInfo.getPersistenceProviderClassName(); if (providerClassName == null || providerClassName.equals("") || providerClassName.equals(EntityManagerFactoryProvider.class.getName()) || providerClassName.equals(PersistenceProvider.class.getName())){ ! Set tempLoaderSet = PersistenceUnitProcessor.buildClassSet(persistenceUnitInfo, Thread.currentThread().getContextClassLoader()); // Create the temp loader that will not cache classes for entities in our persistence unit ClassLoader tempLoader = createTempLoader(tempLoaderSet); persistenceUnitInfo.setNewTempClassLoader(tempLoader); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/MetadataDescriptor.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000024/AB0952363AC40CBFE034080020E8C54E.44 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000024/AB0952363AC40CBFE034080020E8C54E.44 Fri Oct 13 14:06:38 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/MetadataDescriptor.java Mon Oct 16 16:52:08 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.ejb.cmp3.metadata; import java.lang.reflect.Type; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.ejb.cmp3.metadata; import java.lang.reflect.Type; *************** *** 64,69 **** --- 64,70 ---- public class MetadataDescriptor { protected ClassAccessor m_accessor; protected ClassDescriptor m_descriptor; + protected Class m_javaClass; protected Boolean m_usesPropertyAccess; *************** *** 430,436 **** * INTERNAL: */ public Class getJavaClass() { ! return m_descriptor.getJavaClass(); } /** --- 431,437 ---- * INTERNAL: */ public Class getJavaClass() { ! return m_javaClass; } /** *************** *** 817,823 **** * Used to set this descriptors java class. */ public void setJavaClass(Class javaClass) { ! m_descriptor.setJavaClass(javaClass); m_descriptor.setJavaClassName(javaClass.getName()); } --- 818,824 ---- * Used to set this descriptors java class. */ public void setJavaClass(Class javaClass) { ! m_javaClass = javaClass; m_descriptor.setJavaClassName(javaClass.getName()); } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/MetadataProcessor.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000025/AB0952363AC40CBFE034080020E8C54E.56 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000025/AB0952363AC40CBFE034080020E8C54E.56 Fri Oct 13 14:06:39 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/MetadataProcessor.java Mon Oct 16 16:52:08 2006 *************** *** 117,122 **** --- 117,124 ---- // Process all descriptors that are in our project. ClassAccessor accessor = descriptor.getClassAccessor(); + descriptor.setJavaClass(descriptor.getDescriptor().getJavaClass()); + // The class loader has changed, update the class stored for // our class accessor and its list of mapped superclasses. accessor.setAnnotatedElement(descriptor.getJavaClass()); *************** *** 421,427 **** RuntimeException e, String mf, boolean throwException){ ! if (!throwException) { // fail quietly m_session.log(SessionLog.CONFIG, SessionLog.EJB_ORM, --- 423,434 ---- RuntimeException e, String mf, boolean throwException){ ! if (m_session == null){ ! AbstractSessionLog.getLog().log(SessionLog.CONFIG, ! SessionLog.EJB_ORM, ! EntityManagerSetupImpl.ERROR_LOADING_XML_FILE, ! e); ! } else if (!throwException) { // fail quietly m_session.log(SessionLog.CONFIG, SessionLog.EJB_ORM, *************** *** 493,499 **** * * @return */ ! private Set buildEntityClassSetFromXMLDocuments() { HashSet classSet = new HashSet(); for (Map.Entry urlToDoc : m_project.getMappingFiles().entrySet()) { --- 500,506 ---- * * @return */ ! public Set buildEntityClassSetFromXMLDocuments() { HashSet classSet = new HashSet(); for (Map.Entry urlToDoc : m_project.getMappingFiles().entrySet()) { *************** *** 570,575 **** * @param msg message to be logged */ private void logMessage(String msg) { ! m_session.logMessage(msg); } } --- 577,586 ---- * @param msg message to be logged */ private void logMessage(String msg) { ! if (m_session == null){ ! AbstractSessionLog.getLog().log(SessionLog.FINER, msg); ! } else { ! m_session.logMessage(msg); ! } } } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/accessors/ObjectAccessor.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000026/AB0952363AC40CBFE034080020E8C54E.1 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000026/AB0952363AC40CBFE034080020E8C54E.1 Fri Oct 13 14:06:39 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/accessors/ObjectAccessor.java Mon Oct 16 16:52:08 2006 *************** *** 33,38 **** --- 33,39 ---- import oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataLogger; import oracle.toplink.essentials.internal.helper.DatabaseField; + import oracle.toplink.essentials.internal.indirection.WeavedObjectBasicIndirectionPolicy; import oracle.toplink.essentials.mappings.OneToOneMapping; *************** *** 67,79 **** // If the global weave for value holders is true, the use the value // from usesIndirection. Otherwise, force it to false. ! boolean usesIndirection = (m_project.enableLazyForOneToOne()) ? usesIndirection() : false; ! mapping.setUsesIndirection(usesIndirection); ! // Set the getter and setter methods if access is PROPERTY and the // mapping doesn't use indirection. setAccessorMethods(mapping); ! // Process the cascade types. processCascadeTypes(mapping); --- 68,82 ---- // If the global weave for value holders is true, the use the value // from usesIndirection. Otherwise, force it to false. ! boolean usesIndirection = (m_project.enableLazyForOneToOne()) ? usesIndirection() : false; // Set the getter and setter methods if access is PROPERTY and the // mapping doesn't use indirection. setAccessorMethods(mapping); ! if (usesIndirection && m_descriptor.usesPropertyAccess()) { ! mapping.setIndirectionPolicy(new WeavedObjectBasicIndirectionPolicy(mapping.getSetMethodName())); ! } else { ! mapping.setUsesIndirection(usesIndirection); ! } // Process the cascade types. processCascadeTypes(mapping); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/UpdateAllQueryTestHelper.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000027/AB0952363AC40CBFE034080020E8C54E.4 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000027/AB0952363AC40CBFE034080020E8C54E.4 Fri Oct 13 14:13:11 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/UpdateAllQueryTestHelper.java Mon Oct 16 16:52:08 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.testing.framework; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.testing.framework; *************** *** 244,250 **** static protected Object buildCopy(ClassDescriptor descriptor, Object original, UnitOfWork uow) { Object copy = descriptor.getCopyPolicy().buildClone(original, (oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl)uow); ! descriptor.getObjectBuilder().copyInto(original, copy); return copy; } --- 244,250 ---- static protected Object buildCopy(ClassDescriptor descriptor, Object original, UnitOfWork uow) { Object copy = descriptor.getCopyPolicy().buildClone(original, (oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl)uow); ! descriptor.getObjectBuilder().copyInto(original, copy, true); return copy; } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/junit/JUnitTestCase.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000028/AB0952363AC40CBFE034080020E8C54E.21 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000028/AB0952363AC40CBFE034080020E8C54E.21 Fri Oct 13 14:13:14 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/junit/JUnitTestCase.java Mon Oct 16 16:52:08 2006 *************** *** 25,30 **** --- 25,31 ---- import java.util.Map; import java.util.HashMap; + import java.util.Hashtable; import java.util.Properties; import java.net.URL; import junit.framework.*; *************** *** 53,59 **** public static Map propertiesMap = null; public static Map persistencePropertiesTestMap = new HashMap(); private static EntityManagerFactory emf = null; ! private static EntityManagerFactory emfNamedPersistenceUnit = null; static { // These following properties used for property processing testing. --- 54,60 ---- public static Map propertiesMap = null; public static Map persistencePropertiesTestMap = new HashMap(); private static EntityManagerFactory emf = null; ! private static Map emfNamedPersistenceUnits = null; static { // These following properties used for property processing testing. *************** *** 64,69 **** --- 65,71 ---- persistencePropertiesTestMap.put(TopLinkProperties.JDBC_WRITE_CONNECTIONS_MAX, "9"); persistencePropertiesTestMap.put(TopLinkProperties.JDBC_READ_CONNECTIONS_MIN, "4"); persistencePropertiesTestMap.put(TopLinkProperties.JDBC_READ_CONNECTIONS_MAX, "4"); + emfNamedPersistenceUnits = new Hashtable(); } public JUnitTestCase() { *************** *** 138,152 **** } public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName){ ! if (emfNamedPersistenceUnit == null){ ! emfNamedPersistenceUnit = Persistence.createEntityManagerFactory(persistenceUnitName, getDatabaseProperties()); ! } ! return emfNamedPersistenceUnit; } public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName, Map properties){ if (emfNamedPersistenceUnit == null){ emfNamedPersistenceUnit = Persistence.createEntityManagerFactory(persistenceUnitName, properties); } return emfNamedPersistenceUnit; } --- 140,153 ---- } public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName){ ! return getEntityManagerFactory(persistenceUnitName, getDatabaseProperties()); } public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName, Map properties){ + EntityManagerFactory emfNamedPersistenceUnit = (EntityManagerFactory)emfNamedPersistenceUnits.get("persistenceUnitName"); if (emfNamedPersistenceUnit == null){ emfNamedPersistenceUnit = Persistence.createEntityManagerFactory(persistenceUnitName, properties); + emfNamedPersistenceUnits.put(persistenceUnitName, emfNamedPersistenceUnit); } return emfNamedPersistenceUnit; } *************** *** 162,171 **** return emf != null && emf.isOpen(); } - public static boolean doesEntityManagerFactoryNamedPersistenceUnitExist() { - return emfNamedPersistenceUnit != null && emfNamedPersistenceUnit.isOpen(); - } - public static void closeEntityManagerFactory() { if(emf != null) { if(emf.isOpen()) { --- 163,168 ---- *************** *** 175,181 **** } } ! public static void closeEntityManagerFactoryNamedPersistenceUnit() { if(emfNamedPersistenceUnit != null) { if(emfNamedPersistenceUnit.isOpen()) { emfNamedPersistenceUnit.close(); --- 172,179 ---- } } ! public static void closeEntityManagerFactoryNamedPersistenceUnit(String persistenceUnitName) { ! EntityManagerFactory emfNamedPersistenceUnit = (EntityManagerFactory)emfNamedPersistenceUnits.get("persistenceUnitName"); if(emfNamedPersistenceUnit != null) { if(emfNamedPersistenceUnit.isOpen()) { emfNamedPersistenceUnit.close(); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/advanced/Employee.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000029/AB0952363AC40CBFE034080020E8C54E.20 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000029/AB0952363AC40CBFE034080020E8C54E.20 Fri Oct 13 14:13:40 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/advanced/Employee.java Mon Oct 16 16:52:08 2006 *************** *** 298,301 **** --- 298,305 ---- public String getAnEmptyString() { return ""; } + + public void setAddressField(Address address){ + this.address = address; + } } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/JoinedAttributeAdvancedJunitTest.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000030/AB0952363AC40CBFE034080020E8C54E.6 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000030/AB0952363AC40CBFE034080020E8C54E.6 Fri Oct 13 14:14:41 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/JoinedAttributeAdvancedJunitTest.java Mon Oct 16 16:52:08 2006 *************** *** 790,799 **** ((Employee)iterator.next()).getAddress(); } - if (!addr.getId().equals(emp.getAddress().getId())){ - System.out.println("StopHere id's are not same"); - } - getDbSession().getIdentityMapAccessor().initializeAllIdentityMaps(); ReportQuery query = new ReportQuery(); --- 790,795 ---- ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/EntityManagerJUnitTestSuite.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000031/AB0952363AC40CBFE034080020E8C54E.53 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000031/AB0952363AC40CBFE034080020E8C54E.53 Fri Oct 13 14:14:44 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/EntityManagerJUnitTestSuite.java Mon Oct 16 16:52:08 2006 *************** *** 2692,2697 **** --- 2692,2899 ---- em.close(); } + /** + * Bug 801 + * Test to ensure when property access is used and the underlying variable is changed the change + * is correctly reflected in the database + * + * In this test we test making the change before the object is managed + */ + public void testInitializeFieldForPropertyAccess(){ + Employee employee = new Employee(); + employee.setFirstName("Andy"); + employee.setLastName("Dufresne"); + Address address = new Address(); + address.setCity("Shawshank"); + employee.setAddressField(address); + + EntityManager em = createEntityManager(); + em.getTransaction().begin(); + em.persist(employee); + try{ + em.getTransaction().commit(); + } catch (Exception e){ + em.getTransaction().rollback(); + } + int id = employee.getId(); + + clearCache(); + + employee = (Employee)em.find(Employee.class, new Integer(id)); + address = employee.getAddress(); + + assertTrue("The address was not persisted.", employee.getAddress() != null); + assertTrue("The address was not correctly persisted.", employee.getAddress().getCity().equals("Shawshank")); + + em.getTransaction().begin(); + employee.setAddress(null); + em.remove(address); + em.remove(employee); + em.getTransaction().commit(); + + } + + /** + * Bug 801 + * Test to ensure when property access is used and the underlying variable is changed the change + * is correctly reflected in the database + * + * In this test we test making the change after the object is managed + */ + public void testSetFieldForPropertyAccess(){ + EntityManager em = createEntityManager(); + + Employee employee = new Employee(); + employee.setFirstName("Andy"); + employee.setLastName("Dufresne"); + Address address = new Address(); + address.setCity("Shawshank"); + employee.setAddress(address); + + em.getTransaction().begin(); + em.persist(employee); + em.getTransaction().commit(); + int id = employee.getId(); + int addressId = address.getId(); + + em.getTransaction().begin(); + employee = (Employee)em.find(Employee.class, new Integer(id)); + employee.getAddress(); + + address = new Address(); + address.setCity("Metropolis"); + employee.setAddressField(address); + try{ + em.getTransaction().commit(); + } catch (Exception e){ + em.getTransaction().rollback(); + } + + clearCache(); + + employee = (Employee)em.find(Employee.class, new Integer(id)); + address = employee.getAddress(); + + assertTrue("The address was not persisted.", employee.getAddress() != null); + assertTrue("The address was not correctly persisted.", employee.getAddress().getCity().equals("Metropolis")); + + Address initialAddress = (Address)em.find(Address.class, new Integer(addressId)); + em.getTransaction().begin(); + employee.setAddress(null); + em.remove(address); + em.remove(employee); + em.remove(initialAddress); + em.getTransaction().commit(); + } + + /** + * Bug 801 + * Test to ensure when property access is used and the underlying variable is changed the change + * is correctly reflected in the database + * + * In this test we test making the change after the object is refreshed + */ + public void testSetFieldForPropertyAccessWithRefresh(){ + EntityManager em = createEntityManager(); + + Employee employee = new Employee(); + employee.setFirstName("Andy"); + employee.setLastName("Dufresne"); + Address address = new Address(); + address.setCity("Shawshank"); + employee.setAddress(address); + + em.getTransaction().begin(); + em.persist(employee); + em.getTransaction().commit(); + int id = employee.getId(); + int addressId = address.getId(); + + em.getTransaction().begin(); + em.refresh(employee); + employee.getAddress(); + + address = new Address(); + address.setCity("Metropolis"); + employee.setAddressField(address); + try{ + em.getTransaction().commit(); + } catch (Exception e){ + em.getTransaction().rollback(); + } + + clearCache(); + + employee = (Employee)em.find(Employee.class, new Integer(id)); + address = employee.getAddress(); + + assertTrue("The address was not persisted.", employee.getAddress() != null); + assertTrue("The address was not correctly persisted.", employee.getAddress().getCity().equals("Metropolis")); + + Address initialAddress = (Address)em.find(Address.class, new Integer(addressId)); + em.getTransaction().begin(); + employee.setAddress(null); + em.remove(address); + em.remove(employee); + em.remove(initialAddress); + em.getTransaction().commit(); + } + + /** + * Bug 801 + * Test to ensure when property access is used and the underlying variable is changed the change + * is correctly reflected in the database + * + * In this test we test making the change when an existing object is read into a new EM + */ + public void testSetFieldForPropertyAccessWithNewEM(){ + EntityManager em = createEntityManager(); + + Employee employee = new Employee(); + employee.setFirstName("Andy"); + employee.setLastName("Dufresne"); + Address address = new Address(); + address.setCity("Shawshank"); + employee.setAddress(address); + + em.getTransaction().begin(); + em.persist(employee); + em.getTransaction().commit(); + int id = employee.getId(); + int addressId = address.getId(); + + em = createEntityManager(); + + em.getTransaction().begin(); + employee = em.find(Employee.class, new Integer(id)); + employee.getAddress(); + + address = new Address(); + address.setCity("Metropolis"); + employee.setAddressField(address); + try{ + em.getTransaction().commit(); + } catch (Exception e){ + em.getTransaction().rollback(); + } + + clearCache(); + + employee = (Employee)em.find(Employee.class, new Integer(id)); + address = employee.getAddress(); + + assertTrue("The address was not persisted.", employee.getAddress() != null); + assertTrue("The address was not correctly persisted.", employee.getAddress().getCity().equals("Metropolis")); + + Address initialAddress = (Address)em.find(Address.class, new Integer(addressId)); + em.getTransaction().begin(); + employee.setAddress(null); + em.remove(address); + em.remove(employee); + em.remove(initialAddress); + em.getTransaction().commit(); + } + public static void main(String[] args) { // Now run JUnit. junit.swingui.TestRunner.main(args); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/validation/ValidationTestSuite.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000032/AB0952363AC40CBFE034080020E8C54E.6 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000032/AB0952363AC40CBFE034080020E8C54E.6 Fri Oct 13 14:14:59 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/validation/ValidationTestSuite.java Mon Oct 16 16:52:08 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.testing.tests.cmp3.validation; import java.util.HashMap; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.testing.tests.cmp3.validation; import java.util.HashMap; *************** *** 68,74 **** // Ensure this is done to avoid consecutive tests picking up our // very specific isolated persistence unit. ! this.closeEntityManagerFactoryNamedPersistenceUnit(); } /** --- 68,74 ---- // Ensure this is done to avoid consecutive tests picking up our // very specific isolated persistence unit. ! this.closeEntityManagerFactoryNamedPersistenceUnit("isolated1053"); } /** *************** *** 84,90 **** // Ensure this is done to avoid consecutive tests picking up our // very specific isolated persistence unit. ! this.closeEntityManagerFactoryNamedPersistenceUnit(); } public void testPKClassTypeValidation(){ --- 84,90 ---- // Ensure this is done to avoid consecutive tests picking up our // very specific isolated persistence unit. ! this.closeEntityManagerFactoryNamedPersistenceUnit("isolated1053"); } public void testPKClassTypeValidation(){ ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/essentials/oracle/toplink/essentials/testing/tests/weaving/RelationshipWeaverTestSuite.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000033/AB0952363AC40CBFE034080020E8C54E.14 Report generated at Mon Oct 16 16:52:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000033/AB0952363AC40CBFE034080020E8C54E.14 Mon Oct 16 14:46:29 2006 --- /ade/tware_toplink10i/tltest/source/essentials/oracle/toplink/essentials/testing/tests/weaving/RelationshipWeaverTestSuite.java Mon Oct 16 16:52:08 2006 *************** *** 15,20 **** --- 15,21 ---- import oracle.toplink.essentials.sessions.DatabaseLogin; import oracle.toplink.essentials.sessions.Project; import oracle.toplink.essentials.indirection.ValueHolderInterface; + import oracle.toplink.essentials.indirection.WeavedAttributeValueHolderInterface; import oracle.toplink.essentials.internal.weaving.*; import oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor; *************** *** 115,121 **** } assertNotNull("Weaved Order class does not have '_toplink_item_vh' field", f); assertSame("Weaved Order class' '_toplink_item_vh' field is not a ValueHolder", ! ValueHolderInterface.class, f.getType()); // check that Order's 'customer' field is a ValueHolder f = null; try { --- 116,122 ---- } assertNotNull("Weaved Order class does not have '_toplink_item_vh' field", f); assertSame("Weaved Order class' '_toplink_item_vh' field is not a ValueHolder", ! WeavedAttributeValueHolderInterface.class, f.getType()); // check that Order's 'customer' field is a ValueHolder f = null; try { *************** *** 126,132 **** } assertNotNull("Weaved Order class does not have '_toplink_customer_vh' field", f); assertSame("Weaved Order class' '_toplink_customer_vh' field is not a ValueHolder", ! ValueHolderInterface.class, f.getType()); } /* --- 127,133 ---- } assertNotNull("Weaved Order class does not have '_toplink_customer_vh' field", f); assertSame("Weaved Order class' '_toplink_customer_vh' field is not a ValueHolder", ! WeavedAttributeValueHolderInterface.class, f.getType()); } /* ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/ejb/cmp3/persistence/PersistenceUnitProcessor.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000001/AB0952363AC40CBFE034080020E8C54E.31 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000001/AB0952363AC40CBFE034080020E8C54E.31 Fri Oct 13 13:35:06 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/ejb/cmp3/persistence/PersistenceUnitProcessor.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.ejb.cmp3.persistence; import java.net.URL; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.ejb.cmp3.persistence; import java.net.URL; *************** *** 42,47 **** --- 42,48 ---- import oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException; import oracle.toplink.essentials.exceptions.XMLParseException; + import oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor; import oracle.toplink.essentials.internal.ejb.cmp3.xml.XMLConstants; import oracle.toplink.essentials.internal.ejb.cmp3.xml.parser.PersistenceContentHandler; import oracle.toplink.essentials.internal.ejb.cmp3.xml.parser.XMLException; *************** *** 166,172 **** * Build a set that contains all the class names at a URL * @return a Set of class name strings */ ! public static Set buildClassSet(PersistenceUnitInfo persistenceUnitInfo){ Set set = new HashSet(); set.addAll(persistenceUnitInfo.getManagedClassNames()); Iterator i = persistenceUnitInfo.getJarFileUrls().iterator(); --- 167,173 ---- * Build a set that contains all the class names at a URL * @return a Set of class name strings */ ! public static Set buildClassSet(PersistenceUnitInfo persistenceUnitInfo, ClassLoader loader){ Set set = new HashSet(); set.addAll(persistenceUnitInfo.getManagedClassNames()); Iterator i = persistenceUnitInfo.getJarFileUrls().iterator(); *************** *** 176,185 **** if (!persistenceUnitInfo.excludeUnlistedClasses()){ set.addAll(getClassNamesFromURL(persistenceUnitInfo.getPersistenceUnitRootUrl())); } ! return set; } /** * Search the classpath for persistence archives. A persistence archive is defined as any * part of the class path that contains a META-INF directory with a persistence.xml file in it. * Return a list of the URLs of those files. --- 177,205 ---- if (!persistenceUnitInfo.excludeUnlistedClasses()){ set.addAll(getClassNamesFromURL(persistenceUnitInfo.getPersistenceUnitRootUrl())); } ! set.addAll(buildPersistentClassSetFromXMLDocuments(persistenceUnitInfo, loader)); ! return set; } /** + * Return a Set of the classnames represented in the mapping files specified in info + * @param info + * @param loader + * @return + */ + private static Set buildPersistentClassSetFromXMLDocuments(PersistenceUnitInfo info, ClassLoader loader){ + Set classes = null; + + // Build a MetadataProcessor to search the mapped classes in orm xml documents + // We hand in a null session since none of the functionality required uses a session + MetadataProcessor processor = new MetadataProcessor(info, null, loader, false); + processor.readMappingFiles(false); + classes = processor.buildEntityClassSetFromXMLDocuments(); + + return classes; + } + + /** * Search the classpath for persistence archives. A persistence archive is defined as any * part of the class path that contains a META-INF directory with a persistence.xml file in it. * Return a list of the URLs of those files. ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/DescriptorException.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.11 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.11 Fri Oct 13 13:36:30 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/DescriptorException.java Tue Oct 17 08:46:20 2006 *************** *** 221,226 **** --- 221,227 ---- public final static int NEED_TO_IMPLEMENT_FETCHGROUPTRACKER = 199; public final static int ATTEMPT_TO_REGISTER_DEAD_INDIRECTION = 200; public final static int INTERNAL_ERROR_ACCESSING_PKFIELD = 201; + public final static int INTERNAL_ERROR_SET_METHOD = 202; /** * INTERNAL: *************** *** 1822,1825 **** --- 1823,1836 ---- JavaPlatform.setExceptionCause(exception, underlying); return exception; } + + public static DescriptorException errorAccessingSetMethodOfEntity(Class aClass, String methodName, ClassDescriptor descriptor, Exception underlying) { + Object[] args = { aClass, methodName }; + + DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INTERNAL_ERROR_SET_METHOD, args), descriptor, underlying); + JavaPlatform.setExceptionCause(exception, underlying); + return exception; + } + + } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/PersistenceUnitLoadingException.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.11 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.11 Fri Oct 13 13:36:34 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/PersistenceUnitLoadingException.java Tue Oct 17 08:46:20 2006 *************** *** 28,33 **** --- 28,35 ---- public class PersistenceUnitLoadingException extends TopLinkException { + private String resourceName = null; + public static final int EXCEPTION_LOADING_FROM_DIRECTORY = 30001; public static final int EXCEPTION_LOADING_FROM_JAR = 30002; public static final int EXCEPTION_PROCESSING_PERSISTENCE_UNIT = 30003; *************** *** 69,74 **** --- 71,77 ---- Object[] args = { directory }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_LOADING_FROM_DIRECTORY, args), cause); + loadingException.setResourceName(directory.toString()); loadingException.setErrorCode(EXCEPTION_LOADING_FROM_DIRECTORY); return loadingException; } *************** *** 77,82 **** --- 80,86 ---- Object[] args = { filePath }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, FILE_PATH_MISSING_EXCEPTION, args)); + loadingException.setResourceName(filePath); loadingException.setErrorCode(FILE_PATH_MISSING_EXCEPTION); return loadingException; } *************** *** 85,90 **** --- 89,95 ---- Object[] args = { jarFile }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_LOADING_FROM_JAR, args), cause); + loadingException.setResourceName(jarFile.toString()); loadingException.setErrorCode(EXCEPTION_LOADING_FROM_JAR); return loadingException; } *************** *** 93,98 **** --- 98,104 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_LOADING_FROM_URL, args), cause); + loadingException.setResourceName(url); loadingException.setErrorCode(EXCEPTION_LOADING_FROM_URL); return loadingException; } *************** *** 101,106 **** --- 107,113 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_PROCESSING_PERSISTENCE_UNIT, args), cause); + loadingException.setResourceName(url.toString()); loadingException.setErrorCode(EXCEPTION_PROCESSING_PERSISTENCE_UNIT); return loadingException; } *************** *** 109,114 **** --- 116,122 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_PROCESSING_PERSISTENCE_XML, args), cause); + loadingException.setResourceName(url.toString()); loadingException.setErrorCode(EXCEPTION_PROCESSING_PERSISTENCE_XML); return loadingException; } *************** *** 125,130 **** --- 133,139 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_SEARCHING_FOR_ENTITIES, args), cause); + loadingException.setResourceName(url.toString()); loadingException.setErrorCode(EXCEPTION_SEARCHING_FOR_ENTITIES); return loadingException; } *************** *** 141,146 **** --- 150,156 ---- Object[] args = { fileName }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_OPENING_ORM_XML, args), cause); + loadingException.setResourceName(fileName); loadingException.setErrorCode(EXCEPTION_OPENING_ORM_XML); return loadingException; } *************** *** 149,156 **** --- 159,175 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, COULD_NOT_GET_CLASS_NAMES_FROM_URL, args)); + loadingException.setResourceName(url.toString()); loadingException.setErrorCode(COULD_NOT_GET_CLASS_NAMES_FROM_URL); return loadingException; } + public String getResourceName(){ + return resourceName; + } + + public void setResourceName(String resourceName){ + this.resourceName = resourceName; + } + } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/i18n/DescriptorExceptionResource.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000005/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000005/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:36:34 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/i18n/DescriptorExceptionResource.java Tue Oct 17 08:46:20 2006 *************** *** 218,224 **** { "198", "In order to use ObjectChangeTrackingPolicy or AttributeChangeTrackingPolicy, {0} has to implement ChangeTracker interface." }, { "199", "In order to use Fetch Group, the domain class ({0}) has to implement FetchGroupTracker interface." }, { "200", "Attempt to register an object with dead indirection as a new object. Possibly the object was deleted or removed from the cache during a merge of a serialized clone. This is a concurrency violation, consider a locking strategy." }, ! { "201", "An internal error occurred accessing the primary key object [{0}]." } }; /** --- 218,226 ---- { "198", "In order to use ObjectChangeTrackingPolicy or AttributeChangeTrackingPolicy, {0} has to implement ChangeTracker interface." }, { "199", "In order to use Fetch Group, the domain class ({0}) has to implement FetchGroupTracker interface." }, { "200", "Attempt to register an object with dead indirection as a new object. Possibly the object was deleted or removed from the cache during a merge of a serialized clone. This is a concurrency violation, consider a locking strategy." }, ! { "201", "An internal error occurred accessing the primary key object [{0}]." }, ! { "202", "An internal error occurred while accessing method [{1}] on class [{0}]." } ! }; /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/indirection/ValueHolder.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000006/AB0952363AC40CBFE034080020E8C54E.4 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000006/AB0952363AC40CBFE034080020E8C54E.4 Fri Oct 13 13:41:57 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/indirection/ValueHolder.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.indirection; import java.io.Serializable; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.indirection; import java.io.Serializable; *************** *** 28,41 **** * Purpose: Act as a place holder for a variable that required a value holder interface. * This class should be used to initialze an objects attributes that are using indirection is their mappings. */ ! public class ValueHolder implements ValueHolderInterface, Cloneable, Serializable { ! /** * Stores the wrapped object. */ protected Object value; /** * PUBLIC: * Initialize the holder. */ --- 28,51 ---- * Purpose: Act as a place holder for a variable that required a value holder interface. * This class should be used to initialze an objects attributes that are using indirection is their mappings. */ ! public class ValueHolder implements WeavedAttributeValueHolderInterface, Cloneable, Serializable { ! /** * Stores the wrapped object. */ protected Object value; /** + * The two variable below are used as part of the implementation of WeavedAttributeValueHolderInterface + * They are used to track whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + */ + // Set internally in TopLink when the state of coordination between a weaved valueholder and the underlying property is known + private boolean isCoordinatedWithProperty = false; + // Used to determine if this ValueHolder was added instantiated as part of the constructor of a weaved class + private boolean isNewlyWeavedValueHolder = false; + + /** * PUBLIC: * Initialize the holder. */ *************** *** 73,78 **** --- 83,106 ---- } /** + * Used as part of the implementation of WeavedAttributeValueHolderInterface + * Used to track whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + */ + public boolean isCoordinatedWithProperty(){ + return isCoordinatedWithProperty; + } + + /** + * Used as part of the implementation of WeavedAttributeValueHolderInterface + * Used to determine if this ValueHolder was added instantiated as part of + * the constructor of a weaved class + */ + public boolean isNewlyWeavedValueHolder(){ + return isNewlyWeavedValueHolder; + } + + /** * PUBLIC: * Return a boolean indicating whether the * wrapped object has been set or not. *************** *** 84,89 **** --- 112,142 ---- } /** + * Used as part of the implementation of WeavedAttributeValueHolderInterface + * Used to track whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + * + * This method will be called internall when the state of Coordination between the + * weaved valueholder and the underlying value is known + */ + public void setIsCoordinatedWithProperty(boolean coordinated){ + this.isCoordinatedWithProperty = coordinated; + // this is not a newly weaved valueholder any more since we have done some coordination work + isNewlyWeavedValueHolder = false; + } + + /** + * Used as part of the implementation of WeavedAttributeValueHolderInterface + * Used to determine if this ValueHolder was added instantiated as part of + * the constructor of a weaved class + * + * This method will be called when a ValueHolder is instantiated in a weaved class + */ + public void setIsNewlyWeavedValueHolder(boolean isNew){ + this.isNewlyWeavedValueHolder = isNew; + } + + /** * PUBLIC: * Set the wrapped object. */ ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/indirection/WeavedAttributeValueHolderInterface.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000008/AB0952363AC40CBFE034080020E8C54E.0 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000008/AB0952363AC40CBFE034080020E8C54E.0 Mon Oct 16 16:49:00 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/indirection/WeavedAttributeValueHolderInterface.java Tue Oct 17 08:44:05 2006 *************** *** 0 **** --- 1,43 ---- + package oracle.toplink.essentials.indirection; + + /** + * INTERNAL: + * This interface defines funtionality required by ValueHolders for OneToOneMappings that + * have LAZY access weaved into them and use Property (method) based access + * + * The weaving feature adds a paralell valueholder to the class it weaves and uses that valueholder + * to control the lazy loading. The methods on this interface provide information about how that weaved + * valueholder is related to the underlying value. + * @author tware + * + */ + public interface WeavedAttributeValueHolderInterface extends ValueHolderInterface { + + /** + * When a valueholder is triggered, the weaved code will ensure its value is + * coordinated with the underlying property. This method allows TopLink to determine + * if that has happened. + * @return + */ + public boolean isCoordinatedWithProperty(); + + /** + * TopLink will call this method when the triggering of a weaved valueholder causes it's + * value to be coordinated with the underlying property + */ + public void setIsCoordinatedWithProperty(boolean coordinated); + + /** + * This method returns whether this valueholder has been newly instantiated by weaved code. + * @return + */ + public boolean isNewlyWeavedValueHolder(); + + /** + * TopLink weaving calls this method on any valueholder it weaves into a class to indicate + * that it is new and it's value should not be considered. The method is also called when coordination + * with the underlying value occurs to indicate the value can now be trusted. + * @param isNew + */ + public void setIsNewlyWeavedValueHolder(boolean isNew); + } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/mappings/ForeignReferenceMapping.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000009/AB0952363AC40CBFE034080020E8C54E.24 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000009/AB0952363AC40CBFE034080020E8C54E.24 Fri Oct 13 13:49:02 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/mappings/ForeignReferenceMapping.java Tue Oct 17 08:46:20 2006 *************** *** 321,326 **** --- 321,342 ---- } return attributeValue; } + + /** + * INTERNAL: + * Returns the attribute value from the reference object. + * If the attribute is using indirection the value of the value-holder is returned. + * If the value holder is not instantiated then it is instantiated. + */ + public Object getAttributeValueWithClonedValueHolders(Object object) { + Object attributeValue = getAttributeValueFromObject(object); + if (attributeValue instanceof DatabaseValueHolder){ + return ((DatabaseValueHolder)attributeValue).clone(); + } else if (attributeValue instanceof ValueHolder){ + return ((ValueHolder)attributeValue).clone(); + } + return attributeValue; + } /** * INTERNAL: *************** *** 347,353 **** * If the value holder is not instantiated then it is instantiated. */ public Object getRealAttributeValueFromObject(Object object, AbstractSession session) { ! return getIndirectionPolicy().getRealAttributeValueFromObject(getAttributeValueFromObject(object)); } /** --- 363,369 ---- * If the value holder is not instantiated then it is instantiated. */ public Object getRealAttributeValueFromObject(Object object, AbstractSession session) { ! return getIndirectionPolicy().getRealAttributeValueFromObject(object, getAttributeValueFromObject(object)); } /** *************** *** 814,820 **** return query.shouldCascadeAllParts(); } ! /** * PUBLIC: * Indirection means that a ValueHolder will be put in-between the attribute and the real object. --- 830,836 ---- return query.shouldCascadeAllParts(); } ! /** * PUBLIC: * Indirection means that a ValueHolder will be put in-between the attribute and the real object. *************** *** 825,830 **** --- 841,850 ---- setIndirectionPolicy(new BasicIndirectionPolicy()); } + public void useWeavedIndirection(String setMethodName){ + setIndirectionPolicy(new WeavedObjectBasicIndirectionPolicy(setMethodName)); + } + /** * PUBLIC: * Indirection means that some sort of indirection object will be put in-between the attribute and the real object. ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/mappings/ObjectReferenceMapping.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000010/AB0952363AC40CBFE034080020E8C54E.7 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000010/AB0952363AC40CBFE034080020E8C54E.7 Fri Oct 13 13:49:06 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/mappings/ObjectReferenceMapping.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.mappings; import java.util.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.mappings; import java.util.*; *************** *** 634,640 **** public void cascadePerformRemoveIfRequired(Object object, UnitOfWorkImpl uow, IdentityHashtable visitedObjects){ Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.isCascadeRemove() ){ ! Object reference = getIndirectionPolicy().getRealAttributeValueFromObject(attributeValue); if (reference != null && (! visitedObjects.contains(reference)) ){ visitedObjects.put(reference, reference); uow.performRemove(reference, visitedObjects); --- 634,640 ---- public void cascadePerformRemoveIfRequired(Object object, UnitOfWorkImpl uow, IdentityHashtable visitedObjects){ Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.isCascadeRemove() ){ ! Object reference = getIndirectionPolicy().getRealAttributeValueFromObject(object, attributeValue); if (reference != null && (! visitedObjects.contains(reference)) ){ visitedObjects.put(reference, reference); uow.performRemove(reference, visitedObjects); *************** *** 649,655 **** public void cascadeRegisterNewIfRequired(Object object, UnitOfWorkImpl uow, IdentityHashtable visitedObjects){ Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.isCascadePersist() && getIndirectionPolicy().objectIsInstantiated(attributeValue)){ ! Object reference = getIndirectionPolicy().getRealAttributeValueFromObject(attributeValue); if (reference != null && (! visitedObjects.contains(reference)) ){ visitedObjects.put(reference, reference); uow.registerNewObjectForPersist(reference, visitedObjects); --- 649,655 ---- public void cascadeRegisterNewIfRequired(Object object, UnitOfWorkImpl uow, IdentityHashtable visitedObjects){ Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.isCascadePersist() && getIndirectionPolicy().objectIsInstantiated(attributeValue)){ ! Object reference = getIndirectionPolicy().getRealAttributeValueFromObject(object, attributeValue); if (reference != null && (! visitedObjects.contains(reference)) ){ visitedObjects.put(reference, reference); uow.registerNewObjectForPersist(reference, visitedObjects); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/descriptors/ObjectBuilder.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000011/AB0952363AC40CBFE034080020E8C54E.27 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000011/AB0952363AC40CBFE034080020E8C54E.27 Fri Oct 13 13:52:53 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/descriptors/ObjectBuilder.java Tue Oct 17 08:46:20 2006 *************** *** 1290,1303 **** /** * Copy each attribute from one object into the other. */ ! public void copyInto(Object source, Object target) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. Vector mappings = getDescriptor().getMappings(); for (int index = 0; index < mappings.size(); index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); ! mapping.setAttributeValueInObject(target, mapping.getAttributeValueFromObject(source)); } } /** * Return a copy of the object. --- 1290,1317 ---- /** * Copy each attribute from one object into the other. */ ! public void copyInto(Object source, Object target, boolean cloneOneToOneValueHolders) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. Vector mappings = getDescriptor().getMappings(); for (int index = 0; index < mappings.size(); index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); ! Object value = null; ! if (cloneOneToOneValueHolders && mapping.isForeignReferenceMapping()){ ! value = ((ForeignReferenceMapping)mapping).getAttributeValueWithClonedValueHolders(source); ! } else { ! value = mapping.getAttributeValueFromObject(source); ! } ! mapping.setAttributeValueInObject(target, value); } } + + /** + * Copy each attribute from one object into the other. + */ + public void copyInto(Object source, Object target) { + copyInto(source, target, false); + } + /** * Return a copy of the object. ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/weaving/TopLinkClassWeaver.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000012/AB0952363AC40CBFE034080020E8C54E.10 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000012/AB0952363AC40CBFE034080020E8C54E.10 Fri Oct 13 13:53:13 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/weaving/TopLinkClassWeaver.java Tue Oct 17 08:46:20 2006 *************** *** 41,51 **** public class TopLinkClassWeaver extends ClassAdapter implements Constants { public static final String VHI_CLASSNAME = ! "oracle.toplink.essentials.indirection.ValueHolderInterface"; public static final String VH_SHORT_SIGNATURE = "oracle/toplink/essentials/indirection/ValueHolder"; public static final String VHI_SHORT_SIGNATURE = ! "oracle/toplink/essentials/indirection/ValueHolderInterface"; public static final String VHI_SIGNATURE = "L" + VHI_SHORT_SIGNATURE +";"; public static final String TW_SHORT_SIGNATURE = --- 41,51 ---- public class TopLinkClassWeaver extends ClassAdapter implements Constants { public static final String VHI_CLASSNAME = ! "oracle.toplink.essentials.indirection.WeavedAttributeValueHolderInterface"; public static final String VH_SHORT_SIGNATURE = "oracle/toplink/essentials/indirection/ValueHolder"; public static final String VHI_SHORT_SIGNATURE = ! "oracle/toplink/essentials/indirection/WeavedAttributeValueHolderInterface"; public static final String VHI_SIGNATURE = "L" + VHI_SHORT_SIGNATURE +";"; public static final String TW_SHORT_SIGNATURE = *************** *** 74,89 **** annotations = getTransientAnnotation(); } weavedVH = true; ! cv.visitField(ACC_PRIVATE, "_toplink_" + attribute + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;", null, annotations); } /** * INTERNAL: ! * Add a get method for the newly added valueholder. Adds a method of the followign form: * ! * public ValueHolderInterface _toplink_getvariableName_vh(){ ! * return _toplink_variableName_vh; ! * } */ public void addGetterMethodForValueHolder(ClassDetails classDetails, AttributeDetails attributeDetails){ String attribute = attributeDetails.getAttributeName(); --- 74,95 ---- annotations = getTransientAnnotation(); } weavedVH = true; ! cv.visitField(ACC_PRIVATE, "_toplink_" + attribute + "_vh", VHI_SIGNATURE, null, annotations); } /** * INTERNAL: ! * Add a get method for the newly added valueholder. Adds a method of the following form: * ! * public WeavedAttributeValueHolderInterface _toplink_getfoo_vh(){ ! * if (_toplink_foo_vh.isCoordinatedWithProperty() || _toplink_foo_vh.isNewlyWeavedValueHolder()){ ! * EntityC object = getFoo(); ! * if (object != _toplink_foo_vh.getValue()){ ! * setFoo(object); ! * } ! * } ! * return _toplink_foo_vh; ! * } */ public void addGetterMethodForValueHolder(ClassDetails classDetails, AttributeDetails attributeDetails){ String attribute = attributeDetails.getAttributeName(); *************** *** 91,98 **** // Create a getter method for the new valueholder CodeVisitor cv_get_VH = cv.visitMethod(ACC_PUBLIC, "_toplink_get" + attribute + "_vh", "()" + VHI_SIGNATURE, null, null); cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitFieldInsn(GETFIELD, className, "_toplink_" + attribute + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;"); cv_get_VH.visitInsn(ARETURN); cv_get_VH.visitMaxs(0, 0); } --- 97,140 ---- // Create a getter method for the new valueholder CodeVisitor cv_get_VH = cv.visitMethod(ACC_PUBLIC, "_toplink_get" + attribute + "_vh", "()" + VHI_SIGNATURE, null, null); cv_get_VH.visitVarInsn(ALOAD, 0); ! ! // if (_toplink_foo_vh.isCoordinatedWithProperty() || _toplink_foo_vh.isNewlyWeavedValueHolder()){ ! cv_get_VH.visitFieldInsn(GETFIELD, classDetails.getClassName(), "_toplink_" + attribute + "_vh", VHI_SIGNATURE); ! cv_get_VH.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "isCoordinatedWithProperty", "()Z"); ! Label l0 = new Label(); ! cv_get_VH.visitJumpInsn(IFNE, l0); ! cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitFieldInsn(GETFIELD, classDetails.getClassName(), "_toplink_" + attribute + "_vh", VHI_SIGNATURE); ! cv_get_VH.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "isNewlyWeavedValueHolder", "()Z"); ! Label l1 = new Label(); ! cv_get_VH.visitJumpInsn(IFEQ, l1); ! cv_get_VH.visitLabel(l0); ! cv_get_VH.visitVarInsn(ALOAD, 0); ! ! // EntityC object = getFoo(); ! cv_get_VH.visitMethodInsn(INVOKEVIRTUAL, classDetails.getClassName(), attributeDetails.getGetterMethodName(), "()L" + attributeDetails.getReferenceClass().replace('.','/') + ";"); ! cv_get_VH.visitVarInsn(ASTORE, 1); ! ! // if (object != _toplink_foo_vh.getValue()){ ! cv_get_VH.visitVarInsn(ALOAD, 1); ! cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitFieldInsn(GETFIELD, classDetails.getClassName(), "_toplink_" + attribute + "_vh", VHI_SIGNATURE); ! cv_get_VH.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "getValue", "()Ljava/lang/Object;"); ! cv_get_VH.visitJumpInsn(IF_ACMPEQ, l1); ! ! // setFoo(object); ! cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitVarInsn(ALOAD, 1); ! cv_get_VH.visitMethodInsn(INVOKEVIRTUAL, classDetails.getClassName(), attributeDetails.getSetterMethodName(), "(L" + attributeDetails.getReferenceClass().replace('.','/') + ";)V"); ! ! // } ! cv_get_VH.visitLabel(l1); ! ! // return _toplink_foo_vh; ! cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitFieldInsn(GETFIELD, className, "_toplink_" + attribute + "_vh", VHI_SIGNATURE); cv_get_VH.visitInsn(ARETURN); + cv_get_VH.visitMaxs(0, 0); } *************** *** 100,119 **** * INTERNAL: * Add a set method for the newly added ValueHolder. Adds a method of this form: * ! * public void _toplink_setvariableName_vh(ValueHolderInterface valueholderinterface) ! * _toplink_variableName_vh = valueholderinterface; ! * } */ public void addSetterMethodForValueHolder(ClassDetails classDetails, AttributeDetails attributeDetails){ String attribute = attributeDetails.getAttributeName(); String className = classDetails.getClassName(); // create a setter method for the new valueholder ! CodeVisitor cv_set_value = cv.visitMethod(ACC_PUBLIC, "_toplink_set" + attribute + "_vh", "(Loracle/toplink/essentials/indirection/ValueHolderInterface;)V", null, null); cv_set_value.visitVarInsn(ALOAD, 0); cv_set_value.visitVarInsn(ALOAD, 1); ! cv_set_value.visitFieldInsn(PUTFIELD, className, "_toplink_" + attribute + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;"); cv_set_value.visitInsn(RETURN); cv_set_value.visitMaxs(0, 0); } /** --- 142,203 ---- * INTERNAL: * Add a set method for the newly added ValueHolder. Adds a method of this form: * ! * public void _toplink_setfoo_vh(WeavedAttributeValueHolderInterface valueholderinterface){ ! * _toplink_foo_vh = valueholderinterface; ! * if (valueholderinterface.isInstantiated()){ ! * Object object = getFoo(); ! * Object value = valueholderinterface.getValue(); ! * if (object != value){ ! * setFoo((EntityC)value); ! * } ! * } ! * } */ public void addSetterMethodForValueHolder(ClassDetails classDetails, AttributeDetails attributeDetails){ String attribute = attributeDetails.getAttributeName(); String className = classDetails.getClassName(); // create a setter method for the new valueholder ! CodeVisitor cv_set_value = cv.visitMethod(ACC_PUBLIC, "_toplink_set" + attribute + "_vh", "(" + VHI_SIGNATURE + ")V", null, null); ! ! // _toplink_foo_vh = valueholderinterface; cv_set_value.visitVarInsn(ALOAD, 0); cv_set_value.visitVarInsn(ALOAD, 1); ! cv_set_value.visitFieldInsn(PUTFIELD, className, "_toplink_" + attribute + "_vh", VHI_SIGNATURE); ! ! // if (valueholderinterface.isInstantiated()){ ! cv_set_value.visitVarInsn(ALOAD, 1); ! cv_set_value.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "isInstantiated", "()Z"); ! Label l0 = new Label(); ! cv_set_value.visitJumpInsn(IFEQ, l0); ! ! // Object object = getFoo(); ! cv_set_value.visitVarInsn(ALOAD, 0); ! cv_set_value.visitMethodInsn(INVOKEVIRTUAL, className, attributeDetails.getGetterMethodName(), "()L" + attributeDetails.getReferenceClass().replace('.','/') + ";"); ! cv_set_value.visitVarInsn(ASTORE, 2); ! ! // Object value = valueholderinterface.getValue(); ! cv_set_value.visitVarInsn(ALOAD, 1); ! cv_set_value.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "getValue", "()Ljava/lang/Object;"); ! cv_set_value.visitVarInsn(ASTORE, 3); ! ! // if (object != value){ ! cv_set_value.visitVarInsn(ALOAD, 2); ! cv_set_value.visitVarInsn(ALOAD, 3); ! cv_set_value.visitJumpInsn(IF_ACMPEQ, l0); ! ! // setFoo((EntityC)value); ! cv_set_value.visitVarInsn(ALOAD, 0); ! cv_set_value.visitVarInsn(ALOAD, 3); ! cv_set_value.visitTypeInsn(CHECKCAST, attributeDetails.getReferenceClass().replace('.','/')); ! cv_set_value.visitMethodInsn(INVOKEVIRTUAL, className, attributeDetails.getSetterMethodName(), "(L" + attributeDetails.getReferenceClass().replace('.','/') + ";)V"); ! ! // } ! cv_set_value.visitLabel(l0); ! ! cv_set_value.visitInsn(RETURN); cv_set_value.visitMaxs(0, 0); + } /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/weaving/TopLinkMethodWeaver.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000013/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000013/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:53:13 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/weaving/TopLinkMethodWeaver.java Tue Oct 17 08:46:20 2006 *************** *** 103,108 **** --- 103,109 ---- * has been added, the following line will be added to the constructor. * * _toplink_variableName_vh = new ValueHolder(); + * _toplink_foo_vh.setIsNewlyWeavedValueHolder(true); */ public void weaveConstructorIfRequired(int opcode, String owner, String name, String desc){ if (!constructorInitializationDone && ("".equals(methodName)||"".equals(methodName))) { *************** *** 117,126 **** AttributeDetails attribute = (AttributeDetails)details.getAttributesMap().get(key); if (attribute.weaveValueHolders() && !attribute.isCollectionMapping() && !attribute.isAttributeOnSuperClass()){ super.visitVarInsn(ALOAD, 0); ! super.visitTypeInsn(NEW, "oracle/toplink/essentials/indirection/ValueHolder"); super.visitInsn(DUP); ! super.visitMethodInsn(INVOKESPECIAL, "oracle/toplink/essentials/indirection/ValueHolder", "", "()V"); ! super.visitFieldInsn(PUTFIELD, details.className, "_toplink_" + attribute.attributeName + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;"); } } } --- 118,132 ---- AttributeDetails attribute = (AttributeDetails)details.getAttributesMap().get(key); if (attribute.weaveValueHolders() && !attribute.isCollectionMapping() && !attribute.isAttributeOnSuperClass()){ super.visitVarInsn(ALOAD, 0); ! super.visitTypeInsn(NEW, TopLinkClassWeaver.VH_SHORT_SIGNATURE); super.visitInsn(DUP); ! super.visitMethodInsn(INVOKESPECIAL, TopLinkClassWeaver.VH_SHORT_SIGNATURE, "", "()V"); ! super.visitFieldInsn(PUTFIELD, details.className, "_toplink_" + attribute.attributeName + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); ! ! super.visitVarInsn(ALOAD, 0); ! super.visitFieldInsn(GETFIELD, details.className, "_toplink_" + attribute.attributeName + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); ! super.visitInsn(ICONST_1); ! super.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "setIsNewlyWeavedValueHolder", "(Z)V"); } } } *************** *** 134,144 **** * * In a getter method for 'attributeName', the following line is added at the beginning of the method * ! * setAttributeName((<AttributeClass>)_toplink_attributeName_vh.getValue()); * * In a setter method, for 'attributeName', the following line is added at the beginning of the method * ! * _toplink_attributeName_vh.setValue(methodArgument); * * TODO: In the end, the call to setValue() should be modified to somehow make use of the result of * the getter method. This behavior has not yet been implemented. --- 140,153 ---- * * In a getter method for 'attributeName', the following line is added at the beginning of the method * ! * if (!_toplink_attributeName_vh.isInstantiated()){ ! * setFoo((EntityC)_toplink_attributeName_vh.getValue()); ! * } * * In a setter method, for 'attributeName', the following line is added at the beginning of the method * ! * _toplink_attributeName_vh.setValue(argument); ! * _toplink_attributeName_vh.setIsCoordinatedWithProperty(true); * * TODO: In the end, the call to setValue() should be modified to somehow make use of the result of * the getter method. This behavior has not yet been implemented. *************** *** 149,167 **** } AttributeDetails attributeDetails = (AttributeDetails)tcw.classDetails.getGetterMethodToAttributeDetails().get(methodName); if (attributeDetails != null && !attributeDetails.isAttributeOnSuperClass()){ cv.visitVarInsn(ALOAD, 0); cv.visitVarInsn(ALOAD, 0); cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "getValue", "()Ljava/lang/Object;"); cv.visitTypeInsn(CHECKCAST, attributeDetails.getReferenceClass().replace('.','/')); cv.visitMethodInsn(INVOKEVIRTUAL, tcw.classDetails.getClassName(), attributeDetails.getSetterMethodName(), "(L" + attributeDetails.getReferenceClass().replace('.','/') + ";)V"); } else { attributeDetails = (AttributeDetails)tcw.classDetails.getSetterMethodToAttributeDetails().get(methodName); if (attributeDetails != null){ cv.visitVarInsn(ALOAD, 0); ! cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;"); cv.visitVarInsn(ALOAD, 1); cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "setValue", "(Ljava/lang/Object;)V"); } } } --- 158,195 ---- } AttributeDetails attributeDetails = (AttributeDetails)tcw.classDetails.getGetterMethodToAttributeDetails().get(methodName); if (attributeDetails != null && !attributeDetails.isAttributeOnSuperClass()){ + + cv.visitVarInsn(ALOAD, 0); + cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); + cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "isInstantiated", "()Z"); + Label l0 = new Label(); + cv.visitJumpInsn(IFNE, l0); + + cv.visitVarInsn(ALOAD, 0); cv.visitVarInsn(ALOAD, 0); cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "getValue", "()Ljava/lang/Object;"); cv.visitTypeInsn(CHECKCAST, attributeDetails.getReferenceClass().replace('.','/')); cv.visitMethodInsn(INVOKEVIRTUAL, tcw.classDetails.getClassName(), attributeDetails.getSetterMethodName(), "(L" + attributeDetails.getReferenceClass().replace('.','/') + ";)V"); + + cv.visitLabel(l0); + //cv.visitVarInsn(ALOAD, 0); + // cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "foo", "L" + attributeDetails.getReferenceClass().replace('.','/') + ";"); + + } else { attributeDetails = (AttributeDetails)tcw.classDetails.getSetterMethodToAttributeDetails().get(methodName); if (attributeDetails != null){ cv.visitVarInsn(ALOAD, 0); ! cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); cv.visitVarInsn(ALOAD, 1); cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "setValue", "(Ljava/lang/Object;)V"); + + cv.visitVarInsn(ALOAD, 0); + cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); + cv.visitInsn(ICONST_1); + cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "setIsCoordinatedWithProperty", "(Z)V"); } } } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/localization/i18n/TraceLocalizationResource.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000014/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000014/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:55:04 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/localization/i18n/TraceLocalizationResource.java Tue Oct 17 08:46:20 2006 *************** *** 255,261 **** { "cmp_init_globalInstrumentation_is_null", "javaSECMPInitializer - global instrumentation is null."}, { "cmp_init_invoke_deploy", "javaSECMPInitializer - deploying {0}."}, { "cmp_init_completed_deploy", "javaSECMPInitializer - completed deploy of {0}."}, ! { "cmp_init_initialize", "javaSECMPInitializer - initializaing {0}."}, { "cmp_init_initialize_from_main", "javaSECMPInitializer - initializing from main."}, { "dbPlaformHelper_detectedVendorPlatform", "Detected Vendor platform: {0}"}, --- 255,261 ---- { "cmp_init_globalInstrumentation_is_null", "javaSECMPInitializer - global instrumentation is null."}, { "cmp_init_invoke_deploy", "javaSECMPInitializer - deploying {0}."}, { "cmp_init_completed_deploy", "javaSECMPInitializer - completed deploy of {0}."}, ! { "cmp_init_initialize", "javaSECMPInitializer - initializing {0}."}, { "cmp_init_initialize_from_main", "javaSECMPInitializer - initializing from main."}, { "dbPlaformHelper_detectedVendorPlatform", "Detected Vendor platform: {0}"}, ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/BasicIndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000015/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000015/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:57:00 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/BasicIndirectionPolicy.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.util.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.util.*; *************** *** 163,180 **** return unitOfWorkIndirectionObject; } } ! /** * INTERNAL: * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object) { // Changed for CR 4245. Use a static reference instead of .class ! if (ClassConstants.ValueHolderInterface_Class.isAssignableFrom(object.getClass())) { ! return ((ValueHolderInterface)object).getValue(); } else { ! return object; } } --- 163,180 ---- return unitOfWorkIndirectionObject; } } ! /** * INTERNAL: * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object, Object attribute) { // Changed for CR 4245. Use a static reference instead of .class ! if (ClassConstants.ValueHolderInterface_Class.isAssignableFrom(attribute.getClass())) { ! return ((ValueHolderInterface)attribute).getValue(); } else { ! return attribute; } } *************** *** 215,224 **** if (holder == null) { holder = new ValueHolder(attributeValue); } else { ! holder.setValue(attributeValue); } super.setRealAttributeValueInObject(target, holder); } /** * INTERNAL: --- 215,225 ---- if (holder == null) { holder = new ValueHolder(attributeValue); } else { ! holder.setValue(attributeValue); } super.setRealAttributeValueInObject(target, holder); } + /** * INTERNAL: *************** *** 226,232 **** * In this case, the attribute type MUST be ValueHolderInterface. */ protected boolean typeIsValid(Class attributeType) { ! return attributeType == ClassConstants.ValueHolderInterface_Class; } /** --- 227,234 ---- * In this case, the attribute type MUST be ValueHolderInterface. */ protected boolean typeIsValid(Class attributeType) { ! return attributeType == ClassConstants.ValueHolderInterface_Class || ! attributeType == ClassConstants.WeavedAttributeValueHolderInterface_Class; } /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/DatabaseValueHolder.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000016/AB0952363AC40CBFE034080020E8C54E.5 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000016/AB0952363AC40CBFE034080020E8C54E.5 Fri Oct 13 13:57:03 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/DatabaseValueHolder.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.io.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.io.*; *************** *** 37,43 **** * @see ValueHolderInterface * @author Dorin Sandu */ ! public abstract class DatabaseValueHolder implements ValueHolderInterface, Cloneable, Serializable { /** Stores the object after it is read from the database. */ protected Object value; --- 37,43 ---- * @see ValueHolderInterface * @author Dorin Sandu */ ! public abstract class DatabaseValueHolder implements WeavedAttributeValueHolderInterface, Cloneable, Serializable { /** Stores the object after it is read from the database. */ protected Object value; *************** *** 50,55 **** --- 50,63 ---- /** Stores the row representation of the object. */ protected AbstractRecord row; + + /** + * The variable below is used as part of the implementation of WeavedAttributeValueHolderInterface + * It is used to track whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + * Set internally in TopLink when the state of coordination between a weaved valueholder and the underlying property is known + */ + protected boolean isCoordinatedWithProperty = false; public Object clone() { try { *************** *** 106,111 **** --- 114,138 ---- public abstract Object instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder unitOfWorkValueHolder); /** + * This method is used as part of the implementation of WeavedAttributeValueHolderInterface + * It is used to check whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + */ + public boolean isCoordinatedWithProperty(){ + return isCoordinatedWithProperty; + } + + /** + * This method is used as part of the implementation of WeavedAttributeValueHolderInterface. + * + * A DatabaseValueHolder is set up by TopLink and will never be a newly weaved valueholder. + * As a result, this method is stubbed out. + */ + public boolean isNewlyWeavedValueHolder(){ + return false; + } + + /** * INTERNAL: * Answers if this valueholder is easy to instantiate. * @return true if getValue() won't trigger a database read. *************** *** 161,166 **** --- 188,194 ---- */ public void privilegedSetValue(Object value) { this.value = value; + isCoordinatedWithProperty = false; } /** *************** *** 186,193 **** --- 214,239 ---- setRow(null); setSession(null); } + + /** + * This method is used as part of the implementation of WeavedAttributeValueHolderInterface + * It is used internally by TopLink to set whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + */ + public void setIsCoordinatedWithProperty(boolean coordinated){ + this.isCoordinatedWithProperty = coordinated; + } /** + * This method is used as part of the implementation of WeavedAttributeValueHolderInterface + * + * A DatabaseValueHolder is set up by TopLink and will never be a newly weaved valueholder + * As a result, this method is stubbed out. + */ + public void setIsNewlyWeavedValueHolder(boolean isNew){ + } + + /** * Set the instantiated flag to true. */ public void setInstantiated() { ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/IndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000017/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000017/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:57:03 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/IndirectionPolicy.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.io.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.io.*; *************** *** 179,185 **** * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public abstract Object getRealAttributeValueFromObject(Object object); /** * INTERNAL: --- 179,185 ---- * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public abstract Object getRealAttributeValueFromObject(Object object, Object attribute); /** * INTERNAL: ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/NoIndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000018/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000018/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:57:03 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/NoIndirectionPolicy.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import oracle.toplink.essentials.queryframework.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import oracle.toplink.essentials.queryframework.*; *************** *** 101,108 **** * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object) { ! return object; } /** --- 101,108 ---- * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object, Object attribute) { ! return attribute; } /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/TransparentIndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000019/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000019/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:57:03 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/TransparentIndirectionPolicy.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.util.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.util.*; *************** *** 248,256 **** * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object) { ! this.getContainerPolicy().sizeFor(object);// forgive me for this hack: but we have to do something to trigger the database read ! return object; } /** --- 248,256 ---- * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object, Object attribute) { ! this.getContainerPolicy().sizeFor(attribute);// forgive me for this hack: but we have to do something to trigger the database read ! return attribute; } /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/WeavedObjectBasicIndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000021/AB0952363AC40CBFE034080020E8C54E.0 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000021/AB0952363AC40CBFE034080020E8C54E.0 Mon Oct 16 16:49:22 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/WeavedObjectBasicIndirectionPolicy.java Tue Oct 17 08:44:27 2006 *************** *** 0 **** --- 1,123 ---- + package oracle.toplink.essentials.internal.indirection; + + import oracle.toplink.essentials.exceptions.DescriptorException; + import oracle.toplink.essentials.indirection.ValueHolder; + import oracle.toplink.essentials.indirection.ValueHolderInterface; + import oracle.toplink.essentials.indirection.WeavedAttributeValueHolderInterface; + import oracle.toplink.essentials.internal.helper.ClassConstants; + import oracle.toplink.essentials.internal.helper.ConversionManager; + import oracle.toplink.essentials.internal.helper.Helper; + import oracle.toplink.essentials.internal.security.PrivilegedAccessHelper; + import oracle.toplink.essentials.internal.security.PrivilegedMethodInvoker; + import oracle.toplink.essentials.internal.sessions.AbstractRecord; + import oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl; + import oracle.toplink.essentials.mappings.DatabaseMapping; + import oracle.toplink.essentials.mappings.ForeignReferenceMapping; + + import java.lang.reflect.InvocationTargetException; + import java.lang.reflect.Method; + import java.security.AccessController; + import java.security.PrivilegedActionException; + + /** + * INTERNAL: + * A WeavedObjectBasicIndirectionPolicy is used by OneToOne mappings that are LAZY through weaving + * and which use Property(method) access. + * + * It extends BasicIndirection by providing the capability of calling the set method that was initially + * mapped in addition to the set method for the weaved valueholder in order to coordinate the value of the + * underlying property with the value stored in the valueholder + * + * @author Tom Ware + * + */ + public class WeavedObjectBasicIndirectionPolicy extends BasicIndirectionPolicy { + + protected String setMethodName = null; // name of the initial set method. + protected Method setMethod = null; // lazily initialized set method based on the set method name + + public WeavedObjectBasicIndirectionPolicy(String setMethodName) { + super(); + this.setMethodName = setMethodName; + } + + /** + * INTERNAL: + * Return the "real" attribute value, as opposed to any wrapper. + * This will trigger the wrapper to instantiate the value. In a weaved policy, this will + * also call the initial setter method to coordinate the values of the valueholder with + * the underlying data + * + */ + public Object getRealAttributeValueFromObject(Object object, Object attribute) { + Object value = super.getRealAttributeValueFromObject(object, attribute); + // Provide the indirection policy with a callback that allows it to do any updates it needs as the result of getting the value + updateValueInObject(object, value, attribute); + return value; + } + + /** + * This method will lazily initialize the set method + * Lazy initialization occurs to that we are not required to have a handle on + * the actual class that we are using until runtime. This helps to satisfy the + * weaving requirement that demands that we avoid loading domain classes into + * the main class loader until after weaving occurs. + * @return + */ + protected Method getSetMethod(){ + if (setMethod == null){ + ForeignReferenceMapping sourceMapping = (ForeignReferenceMapping)mapping; + // The parameter type for the set method must always be the return type of the get method. + Class[] parameterTypes = new Class[1]; + parameterTypes[0] = sourceMapping.getReferenceClass(); + try { + setMethod = Helper.getDeclaredMethod(sourceMapping.getDescriptor().getJavaClass(), setMethodName, parameterTypes); + } catch (NoSuchMethodException e){ + throw DescriptorException.errorAccessingSetMethodOfEntity(sourceMapping.getDescriptor().getJavaClass(), setMethodName ,sourceMapping.getDescriptor(), e); + } + } + return setMethod; + } + + + /** + * Coordinate the valueholder for this mapping with the underlying property by calling the + * initial setter method + */ + public void updateValueInObject(Object object, Object value, Object attributeValue){ + setRealAttributeValueInObject(object, value); + ((WeavedAttributeValueHolderInterface)attributeValue).setIsCoordinatedWithProperty(true); + } + + /** + * INTERNAL: + * Set the value of the appropriate attribute of target to attributeValue. + * In this case, place the value inside the target's ValueHolder. + */ + public void setRealAttributeValueInObject(Object target, Object attributeValue) { + Object[] parameters = new Object[1]; + parameters[0] = attributeValue; + try { + if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){ + try { + AccessController.doPrivileged(new PrivilegedMethodInvoker(getSetMethod(), target, parameters)); + } catch (PrivilegedActionException exception) { + Exception throwableException = exception.getException(); + if (throwableException instanceof IllegalAccessException) { + throw DescriptorException.illegalAccessWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, throwableException); + } else { + throw DescriptorException.targetInvocationWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, throwableException); + } + } + } else { + PrivilegedAccessHelper.invokeMethod(getSetMethod(), target, parameters); + } + } catch (IllegalAccessException exception) { + throw DescriptorException.illegalAccessWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, exception); + } catch (IllegalArgumentException exception) { + throw DescriptorException.illegalArgumentWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, exception); + } catch (InvocationTargetException exception) { + throw DescriptorException.targetInvocationWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, exception); + } + } + } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/helper/ClassConstants.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000022/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000022/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 14:03:51 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/helper/ClassConstants.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.helper; import java.util.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.helper; import java.util.*; *************** *** 66,71 **** --- 66,72 ---- public static final Class ServerSession_Class = oracle.toplink.essentials.threetier.ServerSession.class; public static final Class SessionsSession_Class = oracle.toplink.essentials.sessions.Session.class; public static final Class ValueHolderInterface_Class = oracle.toplink.essentials.indirection.ValueHolderInterface.class; + public static final Class WeavedAttributeValueHolderInterface_Class = oracle.toplink.essentials.indirection.WeavedAttributeValueHolderInterface.class; // Identity map classes public static final Class CacheIdentityMap_Class = oracle.toplink.essentials.internal.identitymaps.CacheIdentityMap.class; ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializer.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000023/AB0952363AC40CBFE034080020E8C54E.25 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000023/AB0952363AC40CBFE034080020E8C54E.25 Fri Oct 13 14:06:05 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializer.java Tue Oct 17 08:46:20 2006 *************** *** 121,127 **** // we will only attempt to deploy when TopLink is specified as the provider or the provider is unspecified String providerClassName = persistenceUnitInfo.getPersistenceProviderClassName(); if (providerClassName == null || providerClassName.equals("") || providerClassName.equals(EntityManagerFactoryProvider.class.getName()) || providerClassName.equals(PersistenceProvider.class.getName())){ ! Set tempLoaderSet = PersistenceUnitProcessor.buildClassSet(persistenceUnitInfo); // Create the temp loader that will not cache classes for entities in our persistence unit ClassLoader tempLoader = createTempLoader(tempLoaderSet); persistenceUnitInfo.setNewTempClassLoader(tempLoader); --- 121,127 ---- // we will only attempt to deploy when TopLink is specified as the provider or the provider is unspecified String providerClassName = persistenceUnitInfo.getPersistenceProviderClassName(); if (providerClassName == null || providerClassName.equals("") || providerClassName.equals(EntityManagerFactoryProvider.class.getName()) || providerClassName.equals(PersistenceProvider.class.getName())){ ! Set tempLoaderSet = PersistenceUnitProcessor.buildClassSet(persistenceUnitInfo, Thread.currentThread().getContextClassLoader()); // Create the temp loader that will not cache classes for entities in our persistence unit ClassLoader tempLoader = createTempLoader(tempLoaderSet); persistenceUnitInfo.setNewTempClassLoader(tempLoader); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/MetadataDescriptor.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000024/AB0952363AC40CBFE034080020E8C54E.44 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000024/AB0952363AC40CBFE034080020E8C54E.44 Fri Oct 13 14:06:38 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/MetadataDescriptor.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.ejb.cmp3.metadata; import java.lang.reflect.Type; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.ejb.cmp3.metadata; import java.lang.reflect.Type; *************** *** 64,69 **** --- 64,70 ---- public class MetadataDescriptor { protected ClassAccessor m_accessor; protected ClassDescriptor m_descriptor; + protected Class m_javaClass; protected Boolean m_usesPropertyAccess; *************** *** 430,436 **** * INTERNAL: */ public Class getJavaClass() { ! return m_descriptor.getJavaClass(); } /** --- 431,437 ---- * INTERNAL: */ public Class getJavaClass() { ! return m_javaClass; } /** *************** *** 817,823 **** * Used to set this descriptors java class. */ public void setJavaClass(Class javaClass) { ! m_descriptor.setJavaClass(javaClass); m_descriptor.setJavaClassName(javaClass.getName()); } --- 818,824 ---- * Used to set this descriptors java class. */ public void setJavaClass(Class javaClass) { ! m_javaClass = javaClass; m_descriptor.setJavaClassName(javaClass.getName()); } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/MetadataProcessor.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000025/AB0952363AC40CBFE034080020E8C54E.56 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000025/AB0952363AC40CBFE034080020E8C54E.56 Fri Oct 13 14:06:39 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/MetadataProcessor.java Tue Oct 17 08:46:20 2006 *************** *** 117,122 **** --- 117,124 ---- // Process all descriptors that are in our project. ClassAccessor accessor = descriptor.getClassAccessor(); + descriptor.setJavaClass(descriptor.getDescriptor().getJavaClass()); + // The class loader has changed, update the class stored for // our class accessor and its list of mapped superclasses. accessor.setAnnotatedElement(descriptor.getJavaClass()); *************** *** 421,427 **** RuntimeException e, String mf, boolean throwException){ ! if (!throwException) { // fail quietly m_session.log(SessionLog.CONFIG, SessionLog.EJB_ORM, --- 423,434 ---- RuntimeException e, String mf, boolean throwException){ ! if (m_session == null){ ! AbstractSessionLog.getLog().log(SessionLog.CONFIG, ! SessionLog.EJB_ORM, ! EntityManagerSetupImpl.ERROR_LOADING_XML_FILE, ! e); ! } else if (!throwException) { // fail quietly m_session.log(SessionLog.CONFIG, SessionLog.EJB_ORM, *************** *** 493,499 **** * * @return */ ! private Set buildEntityClassSetFromXMLDocuments() { HashSet classSet = new HashSet(); for (Map.Entry urlToDoc : m_project.getMappingFiles().entrySet()) { --- 500,506 ---- * * @return */ ! public Set buildEntityClassSetFromXMLDocuments() { HashSet classSet = new HashSet(); for (Map.Entry urlToDoc : m_project.getMappingFiles().entrySet()) { *************** *** 570,575 **** * @param msg message to be logged */ private void logMessage(String msg) { ! m_session.logMessage(msg); } } --- 577,586 ---- * @param msg message to be logged */ private void logMessage(String msg) { ! if (m_session == null){ ! AbstractSessionLog.getLog().log(SessionLog.FINER, msg); ! } else { ! m_session.logMessage(msg); ! } } } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/accessors/ObjectAccessor.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000026/AB0952363AC40CBFE034080020E8C54E.1 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000026/AB0952363AC40CBFE034080020E8C54E.1 Fri Oct 13 14:06:39 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/accessors/ObjectAccessor.java Tue Oct 17 08:46:20 2006 *************** *** 33,38 **** --- 33,39 ---- import oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataLogger; import oracle.toplink.essentials.internal.helper.DatabaseField; + import oracle.toplink.essentials.internal.indirection.WeavedObjectBasicIndirectionPolicy; import oracle.toplink.essentials.mappings.OneToOneMapping; *************** *** 67,79 **** // If the global weave for value holders is true, the use the value // from usesIndirection. Otherwise, force it to false. ! boolean usesIndirection = (m_project.enableLazyForOneToOne()) ? usesIndirection() : false; ! mapping.setUsesIndirection(usesIndirection); ! // Set the getter and setter methods if access is PROPERTY and the // mapping doesn't use indirection. setAccessorMethods(mapping); ! // Process the cascade types. processCascadeTypes(mapping); --- 68,82 ---- // If the global weave for value holders is true, the use the value // from usesIndirection. Otherwise, force it to false. ! boolean usesIndirection = (m_project.enableLazyForOneToOne()) ? usesIndirection() : false; // Set the getter and setter methods if access is PROPERTY and the // mapping doesn't use indirection. setAccessorMethods(mapping); ! if (usesIndirection && m_descriptor.usesPropertyAccess()) { ! mapping.setIndirectionPolicy(new WeavedObjectBasicIndirectionPolicy(mapping.getSetMethodName())); ! } else { ! mapping.setUsesIndirection(usesIndirection); ! } // Process the cascade types. processCascadeTypes(mapping); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/UpdateAllQueryTestHelper.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000027/AB0952363AC40CBFE034080020E8C54E.4 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000027/AB0952363AC40CBFE034080020E8C54E.4 Fri Oct 13 14:13:11 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/UpdateAllQueryTestHelper.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.testing.framework; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.testing.framework; *************** *** 244,250 **** static protected Object buildCopy(ClassDescriptor descriptor, Object original, UnitOfWork uow) { Object copy = descriptor.getCopyPolicy().buildClone(original, (oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl)uow); ! descriptor.getObjectBuilder().copyInto(original, copy); return copy; } --- 244,250 ---- static protected Object buildCopy(ClassDescriptor descriptor, Object original, UnitOfWork uow) { Object copy = descriptor.getCopyPolicy().buildClone(original, (oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl)uow); ! descriptor.getObjectBuilder().copyInto(original, copy, true); return copy; } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/junit/JUnitTestCase.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000028/AB0952363AC40CBFE034080020E8C54E.21 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000028/AB0952363AC40CBFE034080020E8C54E.21 Fri Oct 13 14:13:14 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/junit/JUnitTestCase.java Tue Oct 17 08:46:20 2006 *************** *** 25,30 **** --- 25,31 ---- import java.util.Map; import java.util.HashMap; + import java.util.Hashtable; import java.util.Properties; import java.net.URL; import junit.framework.*; *************** *** 53,59 **** public static Map propertiesMap = null; public static Map persistencePropertiesTestMap = new HashMap(); private static EntityManagerFactory emf = null; ! private static EntityManagerFactory emfNamedPersistenceUnit = null; static { // These following properties used for property processing testing. --- 54,60 ---- public static Map propertiesMap = null; public static Map persistencePropertiesTestMap = new HashMap(); private static EntityManagerFactory emf = null; ! private static Map emfNamedPersistenceUnits = null; static { // These following properties used for property processing testing. *************** *** 64,69 **** --- 65,71 ---- persistencePropertiesTestMap.put(TopLinkProperties.JDBC_WRITE_CONNECTIONS_MAX, "9"); persistencePropertiesTestMap.put(TopLinkProperties.JDBC_READ_CONNECTIONS_MIN, "4"); persistencePropertiesTestMap.put(TopLinkProperties.JDBC_READ_CONNECTIONS_MAX, "4"); + emfNamedPersistenceUnits = new Hashtable(); } public JUnitTestCase() { *************** *** 138,152 **** } public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName){ ! if (emfNamedPersistenceUnit == null){ ! emfNamedPersistenceUnit = Persistence.createEntityManagerFactory(persistenceUnitName, getDatabaseProperties()); ! } ! return emfNamedPersistenceUnit; } public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName, Map properties){ if (emfNamedPersistenceUnit == null){ emfNamedPersistenceUnit = Persistence.createEntityManagerFactory(persistenceUnitName, properties); } return emfNamedPersistenceUnit; } --- 140,153 ---- } public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName){ ! return getEntityManagerFactory(persistenceUnitName, getDatabaseProperties()); } public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName, Map properties){ + EntityManagerFactory emfNamedPersistenceUnit = (EntityManagerFactory)emfNamedPersistenceUnits.get("persistenceUnitName"); if (emfNamedPersistenceUnit == null){ emfNamedPersistenceUnit = Persistence.createEntityManagerFactory(persistenceUnitName, properties); + emfNamedPersistenceUnits.put(persistenceUnitName, emfNamedPersistenceUnit); } return emfNamedPersistenceUnit; } *************** *** 162,171 **** return emf != null && emf.isOpen(); } - public static boolean doesEntityManagerFactoryNamedPersistenceUnitExist() { - return emfNamedPersistenceUnit != null && emfNamedPersistenceUnit.isOpen(); - } - public static void closeEntityManagerFactory() { if(emf != null) { if(emf.isOpen()) { --- 163,168 ---- *************** *** 175,181 **** } } ! public static void closeEntityManagerFactoryNamedPersistenceUnit() { if(emfNamedPersistenceUnit != null) { if(emfNamedPersistenceUnit.isOpen()) { emfNamedPersistenceUnit.close(); --- 172,179 ---- } } ! public static void closeEntityManagerFactoryNamedPersistenceUnit(String persistenceUnitName) { ! EntityManagerFactory emfNamedPersistenceUnit = (EntityManagerFactory)emfNamedPersistenceUnits.get("persistenceUnitName"); if(emfNamedPersistenceUnit != null) { if(emfNamedPersistenceUnit.isOpen()) { emfNamedPersistenceUnit.close(); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/advanced/Employee.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000029/AB0952363AC40CBFE034080020E8C54E.20 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000029/AB0952363AC40CBFE034080020E8C54E.20 Fri Oct 13 14:13:40 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/advanced/Employee.java Tue Oct 17 08:46:20 2006 *************** *** 298,301 **** --- 298,305 ---- public String getAnEmptyString() { return ""; } + + public void setAddressField(Address address){ + this.address = address; + } } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/JoinedAttributeAdvancedJunitTest.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000030/AB0952363AC40CBFE034080020E8C54E.6 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000030/AB0952363AC40CBFE034080020E8C54E.6 Fri Oct 13 14:14:41 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/JoinedAttributeAdvancedJunitTest.java Tue Oct 17 08:46:20 2006 *************** *** 790,799 **** ((Employee)iterator.next()).getAddress(); } - if (!addr.getId().equals(emp.getAddress().getId())){ - System.out.println("StopHere id's are not same"); - } - getDbSession().getIdentityMapAccessor().initializeAllIdentityMaps(); ReportQuery query = new ReportQuery(); --- 790,795 ---- ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/EntityManagerJUnitTestSuite.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000031/AB0952363AC40CBFE034080020E8C54E.53 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000031/AB0952363AC40CBFE034080020E8C54E.53 Fri Oct 13 14:14:44 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/EntityManagerJUnitTestSuite.java Tue Oct 17 08:46:20 2006 *************** *** 2692,2697 **** --- 2692,2899 ---- em.close(); } + /** + * Bug 801 + * Test to ensure when property access is used and the underlying variable is changed the change + * is correctly reflected in the database + * + * In this test we test making the change before the object is managed + */ + public void testInitializeFieldForPropertyAccess(){ + Employee employee = new Employee(); + employee.setFirstName("Andy"); + employee.setLastName("Dufresne"); + Address address = new Address(); + address.setCity("Shawshank"); + employee.setAddressField(address); + + EntityManager em = createEntityManager(); + em.getTransaction().begin(); + em.persist(employee); + try{ + em.getTransaction().commit(); + } catch (Exception e){ + em.getTransaction().rollback(); + } + int id = employee.getId(); + + clearCache(); + + employee = (Employee)em.find(Employee.class, new Integer(id)); + address = employee.getAddress(); + + assertTrue("The address was not persisted.", employee.getAddress() != null); + assertTrue("The address was not correctly persisted.", employee.getAddress().getCity().equals("Shawshank")); + + em.getTransaction().begin(); + employee.setAddress(null); + em.remove(address); + em.remove(employee); + em.getTransaction().commit(); + + } + + /** + * Bug 801 + * Test to ensure when property access is used and the underlying variable is changed the change + * is correctly reflected in the database + * + * In this test we test making the change after the object is managed + */ + public void testSetFieldForPropertyAccess(){ + EntityManager em = createEntityManager(); + + Employee employee = new Employee(); + employee.setFirstName("Andy"); + employee.setLastName("Dufresne"); + Address address = new Address(); + address.setCity("Shawshank"); + employee.setAddress(address); + + em.getTransaction().begin(); + em.persist(employee); + em.getTransaction().commit(); + int id = employee.getId(); + int addressId = address.getId(); + + em.getTransaction().begin(); + employee = (Employee)em.find(Employee.class, new Integer(id)); + employee.getAddress(); + + address = new Address(); + address.setCity("Metropolis"); + employee.setAddressField(address); + try{ + em.getTransaction().commit(); + } catch (Exception e){ + em.getTransaction().rollback(); + } + + clearCache(); + + employee = (Employee)em.find(Employee.class, new Integer(id)); + address = employee.getAddress(); + + assertTrue("The address was not persisted.", employee.getAddress() != null); + assertTrue("The address was not correctly persisted.", employee.getAddress().getCity().equals("Metropolis")); + + Address initialAddress = (Address)em.find(Address.class, new Integer(addressId)); + em.getTransaction().begin(); + employee.setAddress(null); + em.remove(address); + em.remove(employee); + em.remove(initialAddress); + em.getTransaction().commit(); + } + + /** + * Bug 801 + * Test to ensure when property access is used and the underlying variable is changed the change + * is correctly reflected in the database + * + * In this test we test making the change after the object is refreshed + */ + public void testSetFieldForPropertyAccessWithRefresh(){ + EntityManager em = createEntityManager(); + + Employee employee = new Employee(); + employee.setFirstName("Andy"); + employee.setLastName("Dufresne"); + Address address = new Address(); + address.setCity("Shawshank"); + employee.setAddress(address); + + em.getTransaction().begin(); + em.persist(employee); + em.getTransaction().commit(); + int id = employee.getId(); + int addressId = address.getId(); + + em.getTransaction().begin(); + em.refresh(employee); + employee.getAddress(); + + address = new Address(); + address.setCity("Metropolis"); + employee.setAddressField(address); + try{ + em.getTransaction().commit(); + } catch (Exception e){ + em.getTransaction().rollback(); + } + + clearCache(); + + employee = (Employee)em.find(Employee.class, new Integer(id)); + address = employee.getAddress(); + + assertTrue("The address was not persisted.", employee.getAddress() != null); + assertTrue("The address was not correctly persisted.", employee.getAddress().getCity().equals("Metropolis")); + + Address initialAddress = (Address)em.find(Address.class, new Integer(addressId)); + em.getTransaction().begin(); + employee.setAddress(null); + em.remove(address); + em.remove(employee); + em.remove(initialAddress); + em.getTransaction().commit(); + } + + /** + * Bug 801 + * Test to ensure when property access is used and the underlying variable is changed the change + * is correctly reflected in the database + * + * In this test we test making the change when an existing object is read into a new EM + */ + public void testSetFieldForPropertyAccessWithNewEM(){ + EntityManager em = createEntityManager(); + + Employee employee = new Employee(); + employee.setFirstName("Andy"); + employee.setLastName("Dufresne"); + Address address = new Address(); + address.setCity("Shawshank"); + employee.setAddress(address); + + em.getTransaction().begin(); + em.persist(employee); + em.getTransaction().commit(); + int id = employee.getId(); + int addressId = address.getId(); + + em = createEntityManager(); + + em.getTransaction().begin(); + employee = em.find(Employee.class, new Integer(id)); + employee.getAddress(); + + address = new Address(); + address.setCity("Metropolis"); + employee.setAddressField(address); + try{ + em.getTransaction().commit(); + } catch (Exception e){ + em.getTransaction().rollback(); + } + + clearCache(); + + employee = (Employee)em.find(Employee.class, new Integer(id)); + address = employee.getAddress(); + + assertTrue("The address was not persisted.", employee.getAddress() != null); + assertTrue("The address was not correctly persisted.", employee.getAddress().getCity().equals("Metropolis")); + + Address initialAddress = (Address)em.find(Address.class, new Integer(addressId)); + em.getTransaction().begin(); + employee.setAddress(null); + em.remove(address); + em.remove(employee); + em.remove(initialAddress); + em.getTransaction().commit(); + } + public static void main(String[] args) { // Now run JUnit. junit.swingui.TestRunner.main(args); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/validation/ValidationTestSuite.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000032/AB0952363AC40CBFE034080020E8C54E.6 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000032/AB0952363AC40CBFE034080020E8C54E.6 Fri Oct 13 14:14:59 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/validation/ValidationTestSuite.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.testing.tests.cmp3.validation; import java.util.HashMap; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.testing.tests.cmp3.validation; import java.util.HashMap; *************** *** 68,74 **** // Ensure this is done to avoid consecutive tests picking up our // very specific isolated persistence unit. ! this.closeEntityManagerFactoryNamedPersistenceUnit(); } /** --- 68,74 ---- // Ensure this is done to avoid consecutive tests picking up our // very specific isolated persistence unit. ! this.closeEntityManagerFactoryNamedPersistenceUnit("isolated1053"); } /** *************** *** 84,90 **** // Ensure this is done to avoid consecutive tests picking up our // very specific isolated persistence unit. ! this.closeEntityManagerFactoryNamedPersistenceUnit(); } public void testPKClassTypeValidation(){ --- 84,90 ---- // Ensure this is done to avoid consecutive tests picking up our // very specific isolated persistence unit. ! this.closeEntityManagerFactoryNamedPersistenceUnit("isolated1053"); } public void testPKClassTypeValidation(){ ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/essentials/oracle/toplink/essentials/testing/tests/weaving/RelationshipWeaverTestSuite.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000033/AB0952363AC40CBFE034080020E8C54E.14 Report generated at Tue Oct 17 08:46:20 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000033/AB0952363AC40CBFE034080020E8C54E.14 Mon Oct 16 14:46:29 2006 --- /ade/tware_toplink10i/tltest/source/essentials/oracle/toplink/essentials/testing/tests/weaving/RelationshipWeaverTestSuite.java Tue Oct 17 08:46:20 2006 *************** *** 15,20 **** --- 15,21 ---- import oracle.toplink.essentials.sessions.DatabaseLogin; import oracle.toplink.essentials.sessions.Project; import oracle.toplink.essentials.indirection.ValueHolderInterface; + import oracle.toplink.essentials.indirection.WeavedAttributeValueHolderInterface; import oracle.toplink.essentials.internal.weaving.*; import oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor; *************** *** 115,121 **** } assertNotNull("Weaved Order class does not have '_toplink_item_vh' field", f); assertSame("Weaved Order class' '_toplink_item_vh' field is not a ValueHolder", ! ValueHolderInterface.class, f.getType()); // check that Order's 'customer' field is a ValueHolder f = null; try { --- 116,122 ---- } assertNotNull("Weaved Order class does not have '_toplink_item_vh' field", f); assertSame("Weaved Order class' '_toplink_item_vh' field is not a ValueHolder", ! WeavedAttributeValueHolderInterface.class, f.getType()); // check that Order's 'customer' field is a ValueHolder f = null; try { *************** *** 126,132 **** } assertNotNull("Weaved Order class does not have '_toplink_customer_vh' field", f); assertSame("Weaved Order class' '_toplink_customer_vh' field is not a ValueHolder", ! ValueHolderInterface.class, f.getType()); } /* --- 127,133 ---- } assertNotNull("Weaved Order class does not have '_toplink_customer_vh' field", f); assertSame("Weaved Order class' '_toplink_customer_vh' field is not a ValueHolder", ! WeavedAttributeValueHolderInterface.class, f.getType()); } /* ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/ejb/cmp3/persistence/PersistenceUnitProcessor.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000001/AB0952363AC40CBFE034080020E8C54E.31 Report generated at Tue Oct 17 08:59:22 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000001/AB0952363AC40CBFE034080020E8C54E.31 Fri Oct 13 13:35:06 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/ejb/cmp3/persistence/PersistenceUnitProcessor.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.ejb.cmp3.persistence; import java.net.URL; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.ejb.cmp3.persistence; import java.net.URL; *************** *** 42,47 **** --- 42,48 ---- import oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException; import oracle.toplink.essentials.exceptions.XMLParseException; + import oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor; import oracle.toplink.essentials.internal.ejb.cmp3.xml.XMLConstants; import oracle.toplink.essentials.internal.ejb.cmp3.xml.parser.PersistenceContentHandler; import oracle.toplink.essentials.internal.ejb.cmp3.xml.parser.XMLException; *************** *** 166,172 **** * Build a set that contains all the class names at a URL * @return a Set of class name strings */ ! public static Set buildClassSet(PersistenceUnitInfo persistenceUnitInfo){ Set set = new HashSet(); set.addAll(persistenceUnitInfo.getManagedClassNames()); Iterator i = persistenceUnitInfo.getJarFileUrls().iterator(); --- 167,173 ---- * Build a set that contains all the class names at a URL * @return a Set of class name strings */ ! public static Set buildClassSet(PersistenceUnitInfo persistenceUnitInfo, ClassLoader loader){ Set set = new HashSet(); set.addAll(persistenceUnitInfo.getManagedClassNames()); Iterator i = persistenceUnitInfo.getJarFileUrls().iterator(); *************** *** 176,185 **** if (!persistenceUnitInfo.excludeUnlistedClasses()){ set.addAll(getClassNamesFromURL(persistenceUnitInfo.getPersistenceUnitRootUrl())); } ! return set; } /** * Search the classpath for persistence archives. A persistence archive is defined as any * part of the class path that contains a META-INF directory with a persistence.xml file in it. * Return a list of the URLs of those files. --- 177,205 ---- if (!persistenceUnitInfo.excludeUnlistedClasses()){ set.addAll(getClassNamesFromURL(persistenceUnitInfo.getPersistenceUnitRootUrl())); } ! set.addAll(buildPersistentClassSetFromXMLDocuments(persistenceUnitInfo, loader)); ! return set; } /** + * Return a Set of the classnames represented in the mapping files specified in info + * @param info + * @param loader + * @return + */ + private static Set buildPersistentClassSetFromXMLDocuments(PersistenceUnitInfo info, ClassLoader loader){ + Set classes = null; + + // Build a MetadataProcessor to search the mapped classes in orm xml documents + // We hand in a null session since none of the functionality required uses a session + MetadataProcessor processor = new MetadataProcessor(info, null, loader, false); + processor.readMappingFiles(false); + classes = processor.buildEntityClassSetFromXMLDocuments(); + + return classes; + } + + /** * Search the classpath for persistence archives. A persistence archive is defined as any * part of the class path that contains a META-INF directory with a persistence.xml file in it. * Return a list of the URLs of those files. ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/DescriptorException.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.11 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.11 Fri Oct 13 13:36:30 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/DescriptorException.java Tue Oct 17 08:46:20 2006 *************** *** 221,226 **** --- 221,227 ---- public final static int NEED_TO_IMPLEMENT_FETCHGROUPTRACKER = 199; public final static int ATTEMPT_TO_REGISTER_DEAD_INDIRECTION = 200; public final static int INTERNAL_ERROR_ACCESSING_PKFIELD = 201; + public final static int INTERNAL_ERROR_SET_METHOD = 202; /** * INTERNAL: *************** *** 1822,1825 **** --- 1823,1836 ---- JavaPlatform.setExceptionCause(exception, underlying); return exception; } + + public static DescriptorException errorAccessingSetMethodOfEntity(Class aClass, String methodName, ClassDescriptor descriptor, Exception underlying) { + Object[] args = { aClass, methodName }; + + DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INTERNAL_ERROR_SET_METHOD, args), descriptor, underlying); + JavaPlatform.setExceptionCause(exception, underlying); + return exception; + } + + } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/PersistenceUnitLoadingException.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.11 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.11 Fri Oct 13 13:36:34 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/PersistenceUnitLoadingException.java Tue Oct 17 08:46:20 2006 *************** *** 28,33 **** --- 28,35 ---- public class PersistenceUnitLoadingException extends TopLinkException { + private String resourceName = null; + public static final int EXCEPTION_LOADING_FROM_DIRECTORY = 30001; public static final int EXCEPTION_LOADING_FROM_JAR = 30002; public static final int EXCEPTION_PROCESSING_PERSISTENCE_UNIT = 30003; *************** *** 69,74 **** --- 71,77 ---- Object[] args = { directory }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_LOADING_FROM_DIRECTORY, args), cause); + loadingException.setResourceName(directory.toString()); loadingException.setErrorCode(EXCEPTION_LOADING_FROM_DIRECTORY); return loadingException; } *************** *** 77,82 **** --- 80,86 ---- Object[] args = { filePath }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, FILE_PATH_MISSING_EXCEPTION, args)); + loadingException.setResourceName(filePath); loadingException.setErrorCode(FILE_PATH_MISSING_EXCEPTION); return loadingException; } *************** *** 85,90 **** --- 89,95 ---- Object[] args = { jarFile }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_LOADING_FROM_JAR, args), cause); + loadingException.setResourceName(jarFile.toString()); loadingException.setErrorCode(EXCEPTION_LOADING_FROM_JAR); return loadingException; } *************** *** 93,98 **** --- 98,104 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_LOADING_FROM_URL, args), cause); + loadingException.setResourceName(url); loadingException.setErrorCode(EXCEPTION_LOADING_FROM_URL); return loadingException; } *************** *** 101,106 **** --- 107,113 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_PROCESSING_PERSISTENCE_UNIT, args), cause); + loadingException.setResourceName(url.toString()); loadingException.setErrorCode(EXCEPTION_PROCESSING_PERSISTENCE_UNIT); return loadingException; } *************** *** 109,114 **** --- 116,122 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_PROCESSING_PERSISTENCE_XML, args), cause); + loadingException.setResourceName(url.toString()); loadingException.setErrorCode(EXCEPTION_PROCESSING_PERSISTENCE_XML); return loadingException; } *************** *** 125,130 **** --- 133,139 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_SEARCHING_FOR_ENTITIES, args), cause); + loadingException.setResourceName(url.toString()); loadingException.setErrorCode(EXCEPTION_SEARCHING_FOR_ENTITIES); return loadingException; } *************** *** 141,146 **** --- 150,156 ---- Object[] args = { fileName }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, EXCEPTION_OPENING_ORM_XML, args), cause); + loadingException.setResourceName(fileName); loadingException.setErrorCode(EXCEPTION_OPENING_ORM_XML); return loadingException; } *************** *** 149,156 **** --- 159,175 ---- Object[] args = { url }; PersistenceUnitLoadingException loadingException = new PersistenceUnitLoadingException(ExceptionMessageGenerator.buildMessage(PersistenceUnitLoadingException.class, COULD_NOT_GET_CLASS_NAMES_FROM_URL, args)); + loadingException.setResourceName(url.toString()); loadingException.setErrorCode(COULD_NOT_GET_CLASS_NAMES_FROM_URL); return loadingException; } + public String getResourceName(){ + return resourceName; + } + + public void setResourceName(String resourceName){ + this.resourceName = resourceName; + } + } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/i18n/DescriptorExceptionResource.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000005/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000005/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:36:34 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/exceptions/i18n/DescriptorExceptionResource.java Tue Oct 17 08:46:20 2006 *************** *** 218,224 **** { "198", "In order to use ObjectChangeTrackingPolicy or AttributeChangeTrackingPolicy, {0} has to implement ChangeTracker interface." }, { "199", "In order to use Fetch Group, the domain class ({0}) has to implement FetchGroupTracker interface." }, { "200", "Attempt to register an object with dead indirection as a new object. Possibly the object was deleted or removed from the cache during a merge of a serialized clone. This is a concurrency violation, consider a locking strategy." }, ! { "201", "An internal error occurred accessing the primary key object [{0}]." } }; /** --- 218,226 ---- { "198", "In order to use ObjectChangeTrackingPolicy or AttributeChangeTrackingPolicy, {0} has to implement ChangeTracker interface." }, { "199", "In order to use Fetch Group, the domain class ({0}) has to implement FetchGroupTracker interface." }, { "200", "Attempt to register an object with dead indirection as a new object. Possibly the object was deleted or removed from the cache during a merge of a serialized clone. This is a concurrency violation, consider a locking strategy." }, ! { "201", "An internal error occurred accessing the primary key object [{0}]." }, ! { "202", "An internal error occurred while accessing method [{1}] on class [{0}]." } ! }; /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/indirection/ValueHolder.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000006/AB0952363AC40CBFE034080020E8C54E.4 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000006/AB0952363AC40CBFE034080020E8C54E.4 Fri Oct 13 13:41:57 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/indirection/ValueHolder.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.indirection; import java.io.Serializable; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.indirection; import java.io.Serializable; *************** *** 28,41 **** * Purpose: Act as a place holder for a variable that required a value holder interface. * This class should be used to initialze an objects attributes that are using indirection is their mappings. */ ! public class ValueHolder implements ValueHolderInterface, Cloneable, Serializable { ! /** * Stores the wrapped object. */ protected Object value; /** * PUBLIC: * Initialize the holder. */ --- 28,51 ---- * Purpose: Act as a place holder for a variable that required a value holder interface. * This class should be used to initialze an objects attributes that are using indirection is their mappings. */ ! public class ValueHolder implements WeavedAttributeValueHolderInterface, Cloneable, Serializable { ! /** * Stores the wrapped object. */ protected Object value; /** + * The two variable below are used as part of the implementation of WeavedAttributeValueHolderInterface + * They are used to track whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + */ + // Set internally in TopLink when the state of coordination between a weaved valueholder and the underlying property is known + private boolean isCoordinatedWithProperty = false; + // Used to determine if this ValueHolder was added instantiated as part of the constructor of a weaved class + private boolean isNewlyWeavedValueHolder = false; + + /** * PUBLIC: * Initialize the holder. */ *************** *** 73,78 **** --- 83,106 ---- } /** + * Used as part of the implementation of WeavedAttributeValueHolderInterface + * Used to track whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + */ + public boolean isCoordinatedWithProperty(){ + return isCoordinatedWithProperty; + } + + /** + * Used as part of the implementation of WeavedAttributeValueHolderInterface + * Used to determine if this ValueHolder was added instantiated as part of + * the constructor of a weaved class + */ + public boolean isNewlyWeavedValueHolder(){ + return isNewlyWeavedValueHolder; + } + + /** * PUBLIC: * Return a boolean indicating whether the * wrapped object has been set or not. *************** *** 84,89 **** --- 112,142 ---- } /** + * Used as part of the implementation of WeavedAttributeValueHolderInterface + * Used to track whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + * + * This method will be called internall when the state of Coordination between the + * weaved valueholder and the underlying value is known + */ + public void setIsCoordinatedWithProperty(boolean coordinated){ + this.isCoordinatedWithProperty = coordinated; + // this is not a newly weaved valueholder any more since we have done some coordination work + isNewlyWeavedValueHolder = false; + } + + /** + * Used as part of the implementation of WeavedAttributeValueHolderInterface + * Used to determine if this ValueHolder was added instantiated as part of + * the constructor of a weaved class + * + * This method will be called when a ValueHolder is instantiated in a weaved class + */ + public void setIsNewlyWeavedValueHolder(boolean isNew){ + this.isNewlyWeavedValueHolder = isNew; + } + + /** * PUBLIC: * Set the wrapped object. */ ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/indirection/WeavedAttributeValueHolderInterface.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000008/AB0952363AC40CBFE034080020E8C54E.0 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000008/AB0952363AC40CBFE034080020E8C54E.0 Mon Oct 16 16:49:00 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/indirection/WeavedAttributeValueHolderInterface.java Tue Oct 17 08:44:05 2006 *************** *** 0 **** --- 1,43 ---- + package oracle.toplink.essentials.indirection; + + /** + * INTERNAL: + * This interface defines funtionality required by ValueHolders for OneToOneMappings that + * have LAZY access weaved into them and use Property (method) based access + * + * The weaving feature adds a paralell valueholder to the class it weaves and uses that valueholder + * to control the lazy loading. The methods on this interface provide information about how that weaved + * valueholder is related to the underlying value. + * @author tware + * + */ + public interface WeavedAttributeValueHolderInterface extends ValueHolderInterface { + + /** + * When a valueholder is triggered, the weaved code will ensure its value is + * coordinated with the underlying property. This method allows TopLink to determine + * if that has happened. + * @return + */ + public boolean isCoordinatedWithProperty(); + + /** + * TopLink will call this method when the triggering of a weaved valueholder causes it's + * value to be coordinated with the underlying property + */ + public void setIsCoordinatedWithProperty(boolean coordinated); + + /** + * This method returns whether this valueholder has been newly instantiated by weaved code. + * @return + */ + public boolean isNewlyWeavedValueHolder(); + + /** + * TopLink weaving calls this method on any valueholder it weaves into a class to indicate + * that it is new and it's value should not be considered. The method is also called when coordination + * with the underlying value occurs to indicate the value can now be trusted. + * @param isNew + */ + public void setIsNewlyWeavedValueHolder(boolean isNew); + } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/mappings/ForeignReferenceMapping.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000009/AB0952363AC40CBFE034080020E8C54E.24 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000009/AB0952363AC40CBFE034080020E8C54E.24 Fri Oct 13 13:49:02 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/mappings/ForeignReferenceMapping.java Tue Oct 17 08:46:20 2006 *************** *** 321,326 **** --- 321,342 ---- } return attributeValue; } + + /** + * INTERNAL: + * Returns the attribute value from the reference object. + * If the attribute is using indirection the value of the value-holder is returned. + * If the value holder is not instantiated then it is instantiated. + */ + public Object getAttributeValueWithClonedValueHolders(Object object) { + Object attributeValue = getAttributeValueFromObject(object); + if (attributeValue instanceof DatabaseValueHolder){ + return ((DatabaseValueHolder)attributeValue).clone(); + } else if (attributeValue instanceof ValueHolder){ + return ((ValueHolder)attributeValue).clone(); + } + return attributeValue; + } /** * INTERNAL: *************** *** 347,353 **** * If the value holder is not instantiated then it is instantiated. */ public Object getRealAttributeValueFromObject(Object object, AbstractSession session) { ! return getIndirectionPolicy().getRealAttributeValueFromObject(getAttributeValueFromObject(object)); } /** --- 363,369 ---- * If the value holder is not instantiated then it is instantiated. */ public Object getRealAttributeValueFromObject(Object object, AbstractSession session) { ! return getIndirectionPolicy().getRealAttributeValueFromObject(object, getAttributeValueFromObject(object)); } /** *************** *** 814,820 **** return query.shouldCascadeAllParts(); } ! /** * PUBLIC: * Indirection means that a ValueHolder will be put in-between the attribute and the real object. --- 830,836 ---- return query.shouldCascadeAllParts(); } ! /** * PUBLIC: * Indirection means that a ValueHolder will be put in-between the attribute and the real object. *************** *** 825,830 **** --- 841,850 ---- setIndirectionPolicy(new BasicIndirectionPolicy()); } + public void useWeavedIndirection(String setMethodName){ + setIndirectionPolicy(new WeavedObjectBasicIndirectionPolicy(setMethodName)); + } + /** * PUBLIC: * Indirection means that some sort of indirection object will be put in-between the attribute and the real object. ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/mappings/ObjectReferenceMapping.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000010/AB0952363AC40CBFE034080020E8C54E.7 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000010/AB0952363AC40CBFE034080020E8C54E.7 Fri Oct 13 13:49:06 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/mappings/ObjectReferenceMapping.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.mappings; import java.util.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.mappings; import java.util.*; *************** *** 634,640 **** public void cascadePerformRemoveIfRequired(Object object, UnitOfWorkImpl uow, IdentityHashtable visitedObjects){ Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.isCascadeRemove() ){ ! Object reference = getIndirectionPolicy().getRealAttributeValueFromObject(attributeValue); if (reference != null && (! visitedObjects.contains(reference)) ){ visitedObjects.put(reference, reference); uow.performRemove(reference, visitedObjects); --- 634,640 ---- public void cascadePerformRemoveIfRequired(Object object, UnitOfWorkImpl uow, IdentityHashtable visitedObjects){ Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.isCascadeRemove() ){ ! Object reference = getIndirectionPolicy().getRealAttributeValueFromObject(object, attributeValue); if (reference != null && (! visitedObjects.contains(reference)) ){ visitedObjects.put(reference, reference); uow.performRemove(reference, visitedObjects); *************** *** 649,655 **** public void cascadeRegisterNewIfRequired(Object object, UnitOfWorkImpl uow, IdentityHashtable visitedObjects){ Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.isCascadePersist() && getIndirectionPolicy().objectIsInstantiated(attributeValue)){ ! Object reference = getIndirectionPolicy().getRealAttributeValueFromObject(attributeValue); if (reference != null && (! visitedObjects.contains(reference)) ){ visitedObjects.put(reference, reference); uow.registerNewObjectForPersist(reference, visitedObjects); --- 649,655 ---- public void cascadeRegisterNewIfRequired(Object object, UnitOfWorkImpl uow, IdentityHashtable visitedObjects){ Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.isCascadePersist() && getIndirectionPolicy().objectIsInstantiated(attributeValue)){ ! Object reference = getIndirectionPolicy().getRealAttributeValueFromObject(object, attributeValue); if (reference != null && (! visitedObjects.contains(reference)) ){ visitedObjects.put(reference, reference); uow.registerNewObjectForPersist(reference, visitedObjects); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/descriptors/ObjectBuilder.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000011/AB0952363AC40CBFE034080020E8C54E.27 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000011/AB0952363AC40CBFE034080020E8C54E.27 Fri Oct 13 13:52:53 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/descriptors/ObjectBuilder.java Tue Oct 17 08:46:20 2006 *************** *** 1290,1303 **** /** * Copy each attribute from one object into the other. */ ! public void copyInto(Object source, Object target) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. Vector mappings = getDescriptor().getMappings(); for (int index = 0; index < mappings.size(); index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); ! mapping.setAttributeValueInObject(target, mapping.getAttributeValueFromObject(source)); } } /** * Return a copy of the object. --- 1290,1317 ---- /** * Copy each attribute from one object into the other. */ ! public void copyInto(Object source, Object target, boolean cloneOneToOneValueHolders) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. Vector mappings = getDescriptor().getMappings(); for (int index = 0; index < mappings.size(); index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); ! Object value = null; ! if (cloneOneToOneValueHolders && mapping.isForeignReferenceMapping()){ ! value = ((ForeignReferenceMapping)mapping).getAttributeValueWithClonedValueHolders(source); ! } else { ! value = mapping.getAttributeValueFromObject(source); ! } ! mapping.setAttributeValueInObject(target, value); } } + + /** + * Copy each attribute from one object into the other. + */ + public void copyInto(Object source, Object target) { + copyInto(source, target, false); + } + /** * Return a copy of the object. ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/weaving/TopLinkClassWeaver.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000012/AB0952363AC40CBFE034080020E8C54E.10 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000012/AB0952363AC40CBFE034080020E8C54E.10 Fri Oct 13 13:53:13 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/weaving/TopLinkClassWeaver.java Tue Oct 17 08:46:20 2006 *************** *** 41,51 **** public class TopLinkClassWeaver extends ClassAdapter implements Constants { public static final String VHI_CLASSNAME = ! "oracle.toplink.essentials.indirection.ValueHolderInterface"; public static final String VH_SHORT_SIGNATURE = "oracle/toplink/essentials/indirection/ValueHolder"; public static final String VHI_SHORT_SIGNATURE = ! "oracle/toplink/essentials/indirection/ValueHolderInterface"; public static final String VHI_SIGNATURE = "L" + VHI_SHORT_SIGNATURE +";"; public static final String TW_SHORT_SIGNATURE = --- 41,51 ---- public class TopLinkClassWeaver extends ClassAdapter implements Constants { public static final String VHI_CLASSNAME = ! "oracle.toplink.essentials.indirection.WeavedAttributeValueHolderInterface"; public static final String VH_SHORT_SIGNATURE = "oracle/toplink/essentials/indirection/ValueHolder"; public static final String VHI_SHORT_SIGNATURE = ! "oracle/toplink/essentials/indirection/WeavedAttributeValueHolderInterface"; public static final String VHI_SIGNATURE = "L" + VHI_SHORT_SIGNATURE +";"; public static final String TW_SHORT_SIGNATURE = *************** *** 74,89 **** annotations = getTransientAnnotation(); } weavedVH = true; ! cv.visitField(ACC_PRIVATE, "_toplink_" + attribute + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;", null, annotations); } /** * INTERNAL: ! * Add a get method for the newly added valueholder. Adds a method of the followign form: * ! * public ValueHolderInterface _toplink_getvariableName_vh(){ ! * return _toplink_variableName_vh; ! * } */ public void addGetterMethodForValueHolder(ClassDetails classDetails, AttributeDetails attributeDetails){ String attribute = attributeDetails.getAttributeName(); --- 74,95 ---- annotations = getTransientAnnotation(); } weavedVH = true; ! cv.visitField(ACC_PRIVATE, "_toplink_" + attribute + "_vh", VHI_SIGNATURE, null, annotations); } /** * INTERNAL: ! * Add a get method for the newly added valueholder. Adds a method of the following form: * ! * public WeavedAttributeValueHolderInterface _toplink_getfoo_vh(){ ! * if (_toplink_foo_vh.isCoordinatedWithProperty() || _toplink_foo_vh.isNewlyWeavedValueHolder()){ ! * EntityC object = getFoo(); ! * if (object != _toplink_foo_vh.getValue()){ ! * setFoo(object); ! * } ! * } ! * return _toplink_foo_vh; ! * } */ public void addGetterMethodForValueHolder(ClassDetails classDetails, AttributeDetails attributeDetails){ String attribute = attributeDetails.getAttributeName(); *************** *** 91,98 **** // Create a getter method for the new valueholder CodeVisitor cv_get_VH = cv.visitMethod(ACC_PUBLIC, "_toplink_get" + attribute + "_vh", "()" + VHI_SIGNATURE, null, null); cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitFieldInsn(GETFIELD, className, "_toplink_" + attribute + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;"); cv_get_VH.visitInsn(ARETURN); cv_get_VH.visitMaxs(0, 0); } --- 97,140 ---- // Create a getter method for the new valueholder CodeVisitor cv_get_VH = cv.visitMethod(ACC_PUBLIC, "_toplink_get" + attribute + "_vh", "()" + VHI_SIGNATURE, null, null); cv_get_VH.visitVarInsn(ALOAD, 0); ! ! // if (_toplink_foo_vh.isCoordinatedWithProperty() || _toplink_foo_vh.isNewlyWeavedValueHolder()){ ! cv_get_VH.visitFieldInsn(GETFIELD, classDetails.getClassName(), "_toplink_" + attribute + "_vh", VHI_SIGNATURE); ! cv_get_VH.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "isCoordinatedWithProperty", "()Z"); ! Label l0 = new Label(); ! cv_get_VH.visitJumpInsn(IFNE, l0); ! cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitFieldInsn(GETFIELD, classDetails.getClassName(), "_toplink_" + attribute + "_vh", VHI_SIGNATURE); ! cv_get_VH.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "isNewlyWeavedValueHolder", "()Z"); ! Label l1 = new Label(); ! cv_get_VH.visitJumpInsn(IFEQ, l1); ! cv_get_VH.visitLabel(l0); ! cv_get_VH.visitVarInsn(ALOAD, 0); ! ! // EntityC object = getFoo(); ! cv_get_VH.visitMethodInsn(INVOKEVIRTUAL, classDetails.getClassName(), attributeDetails.getGetterMethodName(), "()L" + attributeDetails.getReferenceClass().replace('.','/') + ";"); ! cv_get_VH.visitVarInsn(ASTORE, 1); ! ! // if (object != _toplink_foo_vh.getValue()){ ! cv_get_VH.visitVarInsn(ALOAD, 1); ! cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitFieldInsn(GETFIELD, classDetails.getClassName(), "_toplink_" + attribute + "_vh", VHI_SIGNATURE); ! cv_get_VH.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "getValue", "()Ljava/lang/Object;"); ! cv_get_VH.visitJumpInsn(IF_ACMPEQ, l1); ! ! // setFoo(object); ! cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitVarInsn(ALOAD, 1); ! cv_get_VH.visitMethodInsn(INVOKEVIRTUAL, classDetails.getClassName(), attributeDetails.getSetterMethodName(), "(L" + attributeDetails.getReferenceClass().replace('.','/') + ";)V"); ! ! // } ! cv_get_VH.visitLabel(l1); ! ! // return _toplink_foo_vh; ! cv_get_VH.visitVarInsn(ALOAD, 0); ! cv_get_VH.visitFieldInsn(GETFIELD, className, "_toplink_" + attribute + "_vh", VHI_SIGNATURE); cv_get_VH.visitInsn(ARETURN); + cv_get_VH.visitMaxs(0, 0); } *************** *** 100,119 **** * INTERNAL: * Add a set method for the newly added ValueHolder. Adds a method of this form: * ! * public void _toplink_setvariableName_vh(ValueHolderInterface valueholderinterface) ! * _toplink_variableName_vh = valueholderinterface; ! * } */ public void addSetterMethodForValueHolder(ClassDetails classDetails, AttributeDetails attributeDetails){ String attribute = attributeDetails.getAttributeName(); String className = classDetails.getClassName(); // create a setter method for the new valueholder ! CodeVisitor cv_set_value = cv.visitMethod(ACC_PUBLIC, "_toplink_set" + attribute + "_vh", "(Loracle/toplink/essentials/indirection/ValueHolderInterface;)V", null, null); cv_set_value.visitVarInsn(ALOAD, 0); cv_set_value.visitVarInsn(ALOAD, 1); ! cv_set_value.visitFieldInsn(PUTFIELD, className, "_toplink_" + attribute + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;"); cv_set_value.visitInsn(RETURN); cv_set_value.visitMaxs(0, 0); } /** --- 142,203 ---- * INTERNAL: * Add a set method for the newly added ValueHolder. Adds a method of this form: * ! * public void _toplink_setfoo_vh(WeavedAttributeValueHolderInterface valueholderinterface){ ! * _toplink_foo_vh = valueholderinterface; ! * if (valueholderinterface.isInstantiated()){ ! * Object object = getFoo(); ! * Object value = valueholderinterface.getValue(); ! * if (object != value){ ! * setFoo((EntityC)value); ! * } ! * } ! * } */ public void addSetterMethodForValueHolder(ClassDetails classDetails, AttributeDetails attributeDetails){ String attribute = attributeDetails.getAttributeName(); String className = classDetails.getClassName(); // create a setter method for the new valueholder ! CodeVisitor cv_set_value = cv.visitMethod(ACC_PUBLIC, "_toplink_set" + attribute + "_vh", "(" + VHI_SIGNATURE + ")V", null, null); ! ! // _toplink_foo_vh = valueholderinterface; cv_set_value.visitVarInsn(ALOAD, 0); cv_set_value.visitVarInsn(ALOAD, 1); ! cv_set_value.visitFieldInsn(PUTFIELD, className, "_toplink_" + attribute + "_vh", VHI_SIGNATURE); ! ! // if (valueholderinterface.isInstantiated()){ ! cv_set_value.visitVarInsn(ALOAD, 1); ! cv_set_value.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "isInstantiated", "()Z"); ! Label l0 = new Label(); ! cv_set_value.visitJumpInsn(IFEQ, l0); ! ! // Object object = getFoo(); ! cv_set_value.visitVarInsn(ALOAD, 0); ! cv_set_value.visitMethodInsn(INVOKEVIRTUAL, className, attributeDetails.getGetterMethodName(), "()L" + attributeDetails.getReferenceClass().replace('.','/') + ";"); ! cv_set_value.visitVarInsn(ASTORE, 2); ! ! // Object value = valueholderinterface.getValue(); ! cv_set_value.visitVarInsn(ALOAD, 1); ! cv_set_value.visitMethodInsn(INVOKEINTERFACE, VHI_SHORT_SIGNATURE, "getValue", "()Ljava/lang/Object;"); ! cv_set_value.visitVarInsn(ASTORE, 3); ! ! // if (object != value){ ! cv_set_value.visitVarInsn(ALOAD, 2); ! cv_set_value.visitVarInsn(ALOAD, 3); ! cv_set_value.visitJumpInsn(IF_ACMPEQ, l0); ! ! // setFoo((EntityC)value); ! cv_set_value.visitVarInsn(ALOAD, 0); ! cv_set_value.visitVarInsn(ALOAD, 3); ! cv_set_value.visitTypeInsn(CHECKCAST, attributeDetails.getReferenceClass().replace('.','/')); ! cv_set_value.visitMethodInsn(INVOKEVIRTUAL, className, attributeDetails.getSetterMethodName(), "(L" + attributeDetails.getReferenceClass().replace('.','/') + ";)V"); ! ! // } ! cv_set_value.visitLabel(l0); ! ! cv_set_value.visitInsn(RETURN); cv_set_value.visitMaxs(0, 0); + } /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/weaving/TopLinkMethodWeaver.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000013/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000013/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:53:13 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/weaving/TopLinkMethodWeaver.java Tue Oct 17 08:46:20 2006 *************** *** 103,108 **** --- 103,109 ---- * has been added, the following line will be added to the constructor. * * _toplink_variableName_vh = new ValueHolder(); + * _toplink_foo_vh.setIsNewlyWeavedValueHolder(true); */ public void weaveConstructorIfRequired(int opcode, String owner, String name, String desc){ if (!constructorInitializationDone && ("".equals(methodName)||"".equals(methodName))) { *************** *** 117,126 **** AttributeDetails attribute = (AttributeDetails)details.getAttributesMap().get(key); if (attribute.weaveValueHolders() && !attribute.isCollectionMapping() && !attribute.isAttributeOnSuperClass()){ super.visitVarInsn(ALOAD, 0); ! super.visitTypeInsn(NEW, "oracle/toplink/essentials/indirection/ValueHolder"); super.visitInsn(DUP); ! super.visitMethodInsn(INVOKESPECIAL, "oracle/toplink/essentials/indirection/ValueHolder", "", "()V"); ! super.visitFieldInsn(PUTFIELD, details.className, "_toplink_" + attribute.attributeName + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;"); } } } --- 118,132 ---- AttributeDetails attribute = (AttributeDetails)details.getAttributesMap().get(key); if (attribute.weaveValueHolders() && !attribute.isCollectionMapping() && !attribute.isAttributeOnSuperClass()){ super.visitVarInsn(ALOAD, 0); ! super.visitTypeInsn(NEW, TopLinkClassWeaver.VH_SHORT_SIGNATURE); super.visitInsn(DUP); ! super.visitMethodInsn(INVOKESPECIAL, TopLinkClassWeaver.VH_SHORT_SIGNATURE, "", "()V"); ! super.visitFieldInsn(PUTFIELD, details.className, "_toplink_" + attribute.attributeName + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); ! ! super.visitVarInsn(ALOAD, 0); ! super.visitFieldInsn(GETFIELD, details.className, "_toplink_" + attribute.attributeName + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); ! super.visitInsn(ICONST_1); ! super.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "setIsNewlyWeavedValueHolder", "(Z)V"); } } } *************** *** 134,144 **** * * In a getter method for 'attributeName', the following line is added at the beginning of the method * ! * setAttributeName((<AttributeClass>)_toplink_attributeName_vh.getValue()); * * In a setter method, for 'attributeName', the following line is added at the beginning of the method * ! * _toplink_attributeName_vh.setValue(methodArgument); * * TODO: In the end, the call to setValue() should be modified to somehow make use of the result of * the getter method. This behavior has not yet been implemented. --- 140,153 ---- * * In a getter method for 'attributeName', the following line is added at the beginning of the method * ! * if (!_toplink_attributeName_vh.isInstantiated()){ ! * setFoo((EntityC)_toplink_attributeName_vh.getValue()); ! * } * * In a setter method, for 'attributeName', the following line is added at the beginning of the method * ! * _toplink_attributeName_vh.setValue(argument); ! * _toplink_attributeName_vh.setIsCoordinatedWithProperty(true); * * TODO: In the end, the call to setValue() should be modified to somehow make use of the result of * the getter method. This behavior has not yet been implemented. *************** *** 149,167 **** } AttributeDetails attributeDetails = (AttributeDetails)tcw.classDetails.getGetterMethodToAttributeDetails().get(methodName); if (attributeDetails != null && !attributeDetails.isAttributeOnSuperClass()){ cv.visitVarInsn(ALOAD, 0); cv.visitVarInsn(ALOAD, 0); cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "getValue", "()Ljava/lang/Object;"); cv.visitTypeInsn(CHECKCAST, attributeDetails.getReferenceClass().replace('.','/')); cv.visitMethodInsn(INVOKEVIRTUAL, tcw.classDetails.getClassName(), attributeDetails.getSetterMethodName(), "(L" + attributeDetails.getReferenceClass().replace('.','/') + ";)V"); } else { attributeDetails = (AttributeDetails)tcw.classDetails.getSetterMethodToAttributeDetails().get(methodName); if (attributeDetails != null){ cv.visitVarInsn(ALOAD, 0); ! cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", "Loracle/toplink/essentials/indirection/ValueHolderInterface;"); cv.visitVarInsn(ALOAD, 1); cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "setValue", "(Ljava/lang/Object;)V"); } } } --- 158,195 ---- } AttributeDetails attributeDetails = (AttributeDetails)tcw.classDetails.getGetterMethodToAttributeDetails().get(methodName); if (attributeDetails != null && !attributeDetails.isAttributeOnSuperClass()){ + + cv.visitVarInsn(ALOAD, 0); + cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); + cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "isInstantiated", "()Z"); + Label l0 = new Label(); + cv.visitJumpInsn(IFNE, l0); + + cv.visitVarInsn(ALOAD, 0); cv.visitVarInsn(ALOAD, 0); cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "getValue", "()Ljava/lang/Object;"); cv.visitTypeInsn(CHECKCAST, attributeDetails.getReferenceClass().replace('.','/')); cv.visitMethodInsn(INVOKEVIRTUAL, tcw.classDetails.getClassName(), attributeDetails.getSetterMethodName(), "(L" + attributeDetails.getReferenceClass().replace('.','/') + ";)V"); + + cv.visitLabel(l0); + //cv.visitVarInsn(ALOAD, 0); + // cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "foo", "L" + attributeDetails.getReferenceClass().replace('.','/') + ";"); + + } else { attributeDetails = (AttributeDetails)tcw.classDetails.getSetterMethodToAttributeDetails().get(methodName); if (attributeDetails != null){ cv.visitVarInsn(ALOAD, 0); ! cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); cv.visitVarInsn(ALOAD, 1); cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "setValue", "(Ljava/lang/Object;)V"); + + cv.visitVarInsn(ALOAD, 0); + cv.visitFieldInsn(GETFIELD, tcw.classDetails.getClassName(), "_toplink_" + attributeDetails.getAttributeName() + "_vh", TopLinkClassWeaver.VHI_SIGNATURE); + cv.visitInsn(ICONST_1); + cv.visitMethodInsn(INVOKEINTERFACE, TopLinkClassWeaver.VHI_SHORT_SIGNATURE, "setIsCoordinatedWithProperty", "(Z)V"); } } } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/localization/i18n/TraceLocalizationResource.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000014/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000014/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:55:04 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/localization/i18n/TraceLocalizationResource.java Tue Oct 17 08:46:20 2006 *************** *** 255,261 **** { "cmp_init_globalInstrumentation_is_null", "javaSECMPInitializer - global instrumentation is null."}, { "cmp_init_invoke_deploy", "javaSECMPInitializer - deploying {0}."}, { "cmp_init_completed_deploy", "javaSECMPInitializer - completed deploy of {0}."}, ! { "cmp_init_initialize", "javaSECMPInitializer - initializaing {0}."}, { "cmp_init_initialize_from_main", "javaSECMPInitializer - initializing from main."}, { "dbPlaformHelper_detectedVendorPlatform", "Detected Vendor platform: {0}"}, --- 255,261 ---- { "cmp_init_globalInstrumentation_is_null", "javaSECMPInitializer - global instrumentation is null."}, { "cmp_init_invoke_deploy", "javaSECMPInitializer - deploying {0}."}, { "cmp_init_completed_deploy", "javaSECMPInitializer - completed deploy of {0}."}, ! { "cmp_init_initialize", "javaSECMPInitializer - initializing {0}."}, { "cmp_init_initialize_from_main", "javaSECMPInitializer - initializing from main."}, { "dbPlaformHelper_detectedVendorPlatform", "Detected Vendor platform: {0}"}, ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/BasicIndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000015/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000015/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:57:00 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/BasicIndirectionPolicy.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.util.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.util.*; *************** *** 163,180 **** return unitOfWorkIndirectionObject; } } ! /** * INTERNAL: * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object) { // Changed for CR 4245. Use a static reference instead of .class ! if (ClassConstants.ValueHolderInterface_Class.isAssignableFrom(object.getClass())) { ! return ((ValueHolderInterface)object).getValue(); } else { ! return object; } } --- 163,180 ---- return unitOfWorkIndirectionObject; } } ! /** * INTERNAL: * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object, Object attribute) { // Changed for CR 4245. Use a static reference instead of .class ! if (ClassConstants.ValueHolderInterface_Class.isAssignableFrom(attribute.getClass())) { ! return ((ValueHolderInterface)attribute).getValue(); } else { ! return attribute; } } *************** *** 215,224 **** if (holder == null) { holder = new ValueHolder(attributeValue); } else { ! holder.setValue(attributeValue); } super.setRealAttributeValueInObject(target, holder); } /** * INTERNAL: --- 215,225 ---- if (holder == null) { holder = new ValueHolder(attributeValue); } else { ! holder.setValue(attributeValue); } super.setRealAttributeValueInObject(target, holder); } + /** * INTERNAL: *************** *** 226,232 **** * In this case, the attribute type MUST be ValueHolderInterface. */ protected boolean typeIsValid(Class attributeType) { ! return attributeType == ClassConstants.ValueHolderInterface_Class; } /** --- 227,234 ---- * In this case, the attribute type MUST be ValueHolderInterface. */ protected boolean typeIsValid(Class attributeType) { ! return attributeType == ClassConstants.ValueHolderInterface_Class || ! attributeType == ClassConstants.WeavedAttributeValueHolderInterface_Class; } /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/DatabaseValueHolder.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000016/AB0952363AC40CBFE034080020E8C54E.5 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000016/AB0952363AC40CBFE034080020E8C54E.5 Fri Oct 13 13:57:03 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/DatabaseValueHolder.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.io.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.io.*; *************** *** 37,43 **** * @see ValueHolderInterface * @author Dorin Sandu */ ! public abstract class DatabaseValueHolder implements ValueHolderInterface, Cloneable, Serializable { /** Stores the object after it is read from the database. */ protected Object value; --- 37,43 ---- * @see ValueHolderInterface * @author Dorin Sandu */ ! public abstract class DatabaseValueHolder implements WeavedAttributeValueHolderInterface, Cloneable, Serializable { /** Stores the object after it is read from the database. */ protected Object value; *************** *** 50,55 **** --- 50,63 ---- /** Stores the row representation of the object. */ protected AbstractRecord row; + + /** + * The variable below is used as part of the implementation of WeavedAttributeValueHolderInterface + * It is used to track whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + * Set internally in TopLink when the state of coordination between a weaved valueholder and the underlying property is known + */ + protected boolean isCoordinatedWithProperty = false; public Object clone() { try { *************** *** 106,111 **** --- 114,138 ---- public abstract Object instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder unitOfWorkValueHolder); /** + * This method is used as part of the implementation of WeavedAttributeValueHolderInterface + * It is used to check whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + */ + public boolean isCoordinatedWithProperty(){ + return isCoordinatedWithProperty; + } + + /** + * This method is used as part of the implementation of WeavedAttributeValueHolderInterface. + * + * A DatabaseValueHolder is set up by TopLink and will never be a newly weaved valueholder. + * As a result, this method is stubbed out. + */ + public boolean isNewlyWeavedValueHolder(){ + return false; + } + + /** * INTERNAL: * Answers if this valueholder is easy to instantiate. * @return true if getValue() won't trigger a database read. *************** *** 161,166 **** --- 188,194 ---- */ public void privilegedSetValue(Object value) { this.value = value; + isCoordinatedWithProperty = false; } /** *************** *** 186,193 **** --- 214,239 ---- setRow(null); setSession(null); } + + /** + * This method is used as part of the implementation of WeavedAttributeValueHolderInterface + * It is used internally by TopLink to set whether a valueholder that has been weaved into a class is coordinated + * with the underlying property + */ + public void setIsCoordinatedWithProperty(boolean coordinated){ + this.isCoordinatedWithProperty = coordinated; + } /** + * This method is used as part of the implementation of WeavedAttributeValueHolderInterface + * + * A DatabaseValueHolder is set up by TopLink and will never be a newly weaved valueholder + * As a result, this method is stubbed out. + */ + public void setIsNewlyWeavedValueHolder(boolean isNew){ + } + + /** * Set the instantiated flag to true. */ public void setInstantiated() { ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/IndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000017/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000017/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:57:03 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/IndirectionPolicy.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.io.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.io.*; *************** *** 179,185 **** * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public abstract Object getRealAttributeValueFromObject(Object object); /** * INTERNAL: --- 179,185 ---- * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public abstract Object getRealAttributeValueFromObject(Object object, Object attribute); /** * INTERNAL: ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/NoIndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000018/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000018/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:57:03 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/NoIndirectionPolicy.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import oracle.toplink.essentials.queryframework.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import oracle.toplink.essentials.queryframework.*; *************** *** 101,108 **** * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object) { ! return object; } /** --- 101,108 ---- * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object, Object attribute) { ! return attribute; } /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/TransparentIndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000019/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000019/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 13:57:03 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/TransparentIndirectionPolicy.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.util.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.indirection; import java.util.*; *************** *** 248,256 **** * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object) { ! this.getContainerPolicy().sizeFor(object);// forgive me for this hack: but we have to do something to trigger the database read ! return object; } /** --- 248,256 ---- * Return the "real" attribute value, as opposed to any wrapper. * This will trigger the wrapper to instantiate the value. */ ! public Object getRealAttributeValueFromObject(Object object, Object attribute) { ! this.getContainerPolicy().sizeFor(attribute);// forgive me for this hack: but we have to do something to trigger the database read ! return attribute; } /** ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/WeavedObjectBasicIndirectionPolicy.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000021/AB0952363AC40CBFE034080020E8C54E.0 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000021/AB0952363AC40CBFE034080020E8C54E.0 Mon Oct 16 16:49:22 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/indirection/WeavedObjectBasicIndirectionPolicy.java Tue Oct 17 08:44:27 2006 *************** *** 0 **** --- 1,123 ---- + package oracle.toplink.essentials.internal.indirection; + + import oracle.toplink.essentials.exceptions.DescriptorException; + import oracle.toplink.essentials.indirection.ValueHolder; + import oracle.toplink.essentials.indirection.ValueHolderInterface; + import oracle.toplink.essentials.indirection.WeavedAttributeValueHolderInterface; + import oracle.toplink.essentials.internal.helper.ClassConstants; + import oracle.toplink.essentials.internal.helper.ConversionManager; + import oracle.toplink.essentials.internal.helper.Helper; + import oracle.toplink.essentials.internal.security.PrivilegedAccessHelper; + import oracle.toplink.essentials.internal.security.PrivilegedMethodInvoker; + import oracle.toplink.essentials.internal.sessions.AbstractRecord; + import oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl; + import oracle.toplink.essentials.mappings.DatabaseMapping; + import oracle.toplink.essentials.mappings.ForeignReferenceMapping; + + import java.lang.reflect.InvocationTargetException; + import java.lang.reflect.Method; + import java.security.AccessController; + import java.security.PrivilegedActionException; + + /** + * INTERNAL: + * A WeavedObjectBasicIndirectionPolicy is used by OneToOne mappings that are LAZY through weaving + * and which use Property(method) access. + * + * It extends BasicIndirection by providing the capability of calling the set method that was initially + * mapped in addition to the set method for the weaved valueholder in order to coordinate the value of the + * underlying property with the value stored in the valueholder + * + * @author Tom Ware + * + */ + public class WeavedObjectBasicIndirectionPolicy extends BasicIndirectionPolicy { + + protected String setMethodName = null; // name of the initial set method. + protected Method setMethod = null; // lazily initialized set method based on the set method name + + public WeavedObjectBasicIndirectionPolicy(String setMethodName) { + super(); + this.setMethodName = setMethodName; + } + + /** + * INTERNAL: + * Return the "real" attribute value, as opposed to any wrapper. + * This will trigger the wrapper to instantiate the value. In a weaved policy, this will + * also call the initial setter method to coordinate the values of the valueholder with + * the underlying data + * + */ + public Object getRealAttributeValueFromObject(Object object, Object attribute) { + Object value = super.getRealAttributeValueFromObject(object, attribute); + // Provide the indirection policy with a callback that allows it to do any updates it needs as the result of getting the value + updateValueInObject(object, value, attribute); + return value; + } + + /** + * This method will lazily initialize the set method + * Lazy initialization occurs to that we are not required to have a handle on + * the actual class that we are using until runtime. This helps to satisfy the + * weaving requirement that demands that we avoid loading domain classes into + * the main class loader until after weaving occurs. + * @return + */ + protected Method getSetMethod(){ + if (setMethod == null){ + ForeignReferenceMapping sourceMapping = (ForeignReferenceMapping)mapping; + // The parameter type for the set method must always be the return type of the get method. + Class[] parameterTypes = new Class[1]; + parameterTypes[0] = sourceMapping.getReferenceClass(); + try { + setMethod = Helper.getDeclaredMethod(sourceMapping.getDescriptor().getJavaClass(), setMethodName, parameterTypes); + } catch (NoSuchMethodException e){ + throw DescriptorException.errorAccessingSetMethodOfEntity(sourceMapping.getDescriptor().getJavaClass(), setMethodName ,sourceMapping.getDescriptor(), e); + } + } + return setMethod; + } + + + /** + * Coordinate the valueholder for this mapping with the underlying property by calling the + * initial setter method + */ + public void updateValueInObject(Object object, Object value, Object attributeValue){ + setRealAttributeValueInObject(object, value); + ((WeavedAttributeValueHolderInterface)attributeValue).setIsCoordinatedWithProperty(true); + } + + /** + * INTERNAL: + * Set the value of the appropriate attribute of target to attributeValue. + * In this case, place the value inside the target's ValueHolder. + */ + public void setRealAttributeValueInObject(Object target, Object attributeValue) { + Object[] parameters = new Object[1]; + parameters[0] = attributeValue; + try { + if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){ + try { + AccessController.doPrivileged(new PrivilegedMethodInvoker(getSetMethod(), target, parameters)); + } catch (PrivilegedActionException exception) { + Exception throwableException = exception.getException(); + if (throwableException instanceof IllegalAccessException) { + throw DescriptorException.illegalAccessWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, throwableException); + } else { + throw DescriptorException.targetInvocationWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, throwableException); + } + } + } else { + PrivilegedAccessHelper.invokeMethod(getSetMethod(), target, parameters); + } + } catch (IllegalAccessException exception) { + throw DescriptorException.illegalAccessWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, exception); + } catch (IllegalArgumentException exception) { + throw DescriptorException.illegalArgumentWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, exception); + } catch (InvocationTargetException exception) { + throw DescriptorException.targetInvocationWhileSettingValueThruMethodAccessor(setMethod.getName(), attributeValue, exception); + } + } + } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/helper/ClassConstants.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000022/AB0952363AC40CBFE034080020E8C54E.8 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000022/AB0952363AC40CBFE034080020E8C54E.8 Fri Oct 13 14:03:51 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/helper/ClassConstants.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.internal.helper; import java.util.*; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.helper; import java.util.*; *************** *** 66,71 **** --- 66,72 ---- public static final Class ServerSession_Class = oracle.toplink.essentials.threetier.ServerSession.class; public static final Class SessionsSession_Class = oracle.toplink.essentials.sessions.Session.class; public static final Class ValueHolderInterface_Class = oracle.toplink.essentials.indirection.ValueHolderInterface.class; + public static final Class WeavedAttributeValueHolderInterface_Class = oracle.toplink.essentials.indirection.WeavedAttributeValueHolderInterface.class; // Identity map classes public static final Class CacheIdentityMap_Class = oracle.toplink.essentials.internal.identitymaps.CacheIdentityMap.class; ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializer.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000023/AB0952363AC40CBFE034080020E8C54E.25 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000023/AB0952363AC40CBFE034080020E8C54E.25 Fri Oct 13 14:06:05 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializer.java Tue Oct 17 08:46:20 2006 *************** *** 121,127 **** // we will only attempt to deploy when TopLink is specified as the provider or the provider is unspecified String providerClassName = persistenceUnitInfo.getPersistenceProviderClassName(); if (providerClassName == null || providerClassName.equals("") || providerClassName.equals(EntityManagerFactoryProvider.class.getName()) || providerClassName.equals(PersistenceProvider.class.getName())){ ! Set tempLoaderSet = PersistenceUnitProcessor.buildClassSet(persistenceUnitInfo); // Create the temp loader that will not cache classes for entities in our persistence unit ClassLoader tempLoader = createTempLoader(tempLoaderSet); persistenceUnitInfo.setNewTempClassLoader(tempLoader); --- 121,127 ---- // we will only attempt to deploy when TopLink is specified as the provider or the provider is unspecified String providerClassName = persistenceUnitInfo.getPersistenceProviderClassName(); if (providerClassName == null || providerClassName.equals("") || providerClassName.equals(EntityManagerFactoryProvider.class.getName()) || providerClassName.equals(PersistenceProvider.class.getName())){ ! Set tempLoaderSet = PersistenceUnitProcessor.buildClassSet(persistenceUnitInfo, Thread.currentThread().getContextClassLoader()); // Create the temp loader that will not cache classes for entities in our persistence unit ClassLoader tempLoader = createTempLoader(tempLoaderSet); persistenceUnitInfo.setNewTempClassLoader(tempLoader); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/MetadataDescriptor.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000024/AB0952363AC40CBFE034080020E8C54E.44 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000024/AB0952363AC40CBFE034080020E8C54E.44 Fri Oct 13 14:06:38 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/MetadataDescriptor.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.ejb.cmp3.metadata; import java.lang.reflect.Type; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.internal.ejb.cmp3.metadata; import java.lang.reflect.Type; *************** *** 64,69 **** --- 64,70 ---- public class MetadataDescriptor { protected ClassAccessor m_accessor; protected ClassDescriptor m_descriptor; + protected Class m_javaClass; protected Boolean m_usesPropertyAccess; *************** *** 430,436 **** * INTERNAL: */ public Class getJavaClass() { ! return m_descriptor.getJavaClass(); } /** --- 431,437 ---- * INTERNAL: */ public Class getJavaClass() { ! return m_javaClass; } /** *************** *** 817,823 **** * Used to set this descriptors java class. */ public void setJavaClass(Class javaClass) { ! m_descriptor.setJavaClass(javaClass); m_descriptor.setJavaClassName(javaClass.getName()); } --- 818,824 ---- * Used to set this descriptors java class. */ public void setJavaClass(Class javaClass) { ! m_javaClass = javaClass; m_descriptor.setJavaClassName(javaClass.getName()); } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/MetadataProcessor.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000025/AB0952363AC40CBFE034080020E8C54E.56 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000025/AB0952363AC40CBFE034080020E8C54E.56 Fri Oct 13 14:06:39 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/MetadataProcessor.java Tue Oct 17 08:46:20 2006 *************** *** 117,122 **** --- 117,124 ---- // Process all descriptors that are in our project. ClassAccessor accessor = descriptor.getClassAccessor(); + descriptor.setJavaClass(descriptor.getDescriptor().getJavaClass()); + // The class loader has changed, update the class stored for // our class accessor and its list of mapped superclasses. accessor.setAnnotatedElement(descriptor.getJavaClass()); *************** *** 421,427 **** RuntimeException e, String mf, boolean throwException){ ! if (!throwException) { // fail quietly m_session.log(SessionLog.CONFIG, SessionLog.EJB_ORM, --- 423,434 ---- RuntimeException e, String mf, boolean throwException){ ! if (m_session == null){ ! AbstractSessionLog.getLog().log(SessionLog.CONFIG, ! SessionLog.EJB_ORM, ! EntityManagerSetupImpl.ERROR_LOADING_XML_FILE, ! e); ! } else if (!throwException) { // fail quietly m_session.log(SessionLog.CONFIG, SessionLog.EJB_ORM, *************** *** 493,499 **** * * @return */ ! private Set buildEntityClassSetFromXMLDocuments() { HashSet classSet = new HashSet(); for (Map.Entry urlToDoc : m_project.getMappingFiles().entrySet()) { --- 500,506 ---- * * @return */ ! public Set buildEntityClassSetFromXMLDocuments() { HashSet classSet = new HashSet(); for (Map.Entry urlToDoc : m_project.getMappingFiles().entrySet()) { *************** *** 570,575 **** * @param msg message to be logged */ private void logMessage(String msg) { ! m_session.logMessage(msg); } } --- 577,586 ---- * @param msg message to be logged */ private void logMessage(String msg) { ! if (m_session == null){ ! AbstractSessionLog.getLog().log(SessionLog.FINER, msg); ! } else { ! m_session.logMessage(msg); ! } } } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/accessors/ObjectAccessor.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000026/AB0952363AC40CBFE034080020E8C54E.1 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000026/AB0952363AC40CBFE034080020E8C54E.1 Fri Oct 13 14:06:39 2006 --- /ade/tware_toplink10i/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/metadata/accessors/ObjectAccessor.java Tue Oct 17 08:46:20 2006 *************** *** 33,38 **** --- 33,39 ---- import oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataLogger; import oracle.toplink.essentials.internal.helper.DatabaseField; + import oracle.toplink.essentials.internal.indirection.WeavedObjectBasicIndirectionPolicy; import oracle.toplink.essentials.mappings.OneToOneMapping; *************** *** 67,79 **** // If the global weave for value holders is true, the use the value // from usesIndirection. Otherwise, force it to false. ! boolean usesIndirection = (m_project.enableLazyForOneToOne()) ? usesIndirection() : false; ! mapping.setUsesIndirection(usesIndirection); ! // Set the getter and setter methods if access is PROPERTY and the // mapping doesn't use indirection. setAccessorMethods(mapping); ! // Process the cascade types. processCascadeTypes(mapping); --- 68,82 ---- // If the global weave for value holders is true, the use the value // from usesIndirection. Otherwise, force it to false. ! boolean usesIndirection = (m_project.enableLazyForOneToOne()) ? usesIndirection() : false; // Set the getter and setter methods if access is PROPERTY and the // mapping doesn't use indirection. setAccessorMethods(mapping); ! if (usesIndirection && m_descriptor.usesPropertyAccess()) { ! mapping.setIndirectionPolicy(new WeavedObjectBasicIndirectionPolicy(mapping.getSetMethodName())); ! } else { ! mapping.setUsesIndirection(usesIndirection); ! } // Process the cascade types. processCascadeTypes(mapping); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/UpdateAllQueryTestHelper.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000027/AB0952363AC40CBFE034080020E8C54E.4 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000027/AB0952363AC40CBFE034080020E8C54E.4 Fri Oct 13 14:13:11 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/UpdateAllQueryTestHelper.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2005, Oracle. All rights reserved. package oracle.toplink.essentials.testing.framework; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.testing.framework; *************** *** 244,250 **** static protected Object buildCopy(ClassDescriptor descriptor, Object original, UnitOfWork uow) { Object copy = descriptor.getCopyPolicy().buildClone(original, (oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl)uow); ! descriptor.getObjectBuilder().copyInto(original, copy); return copy; } --- 244,250 ---- static protected Object buildCopy(ClassDescriptor descriptor, Object original, UnitOfWork uow) { Object copy = descriptor.getCopyPolicy().buildClone(original, (oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl)uow); ! descriptor.getObjectBuilder().copyInto(original, copy, true); return copy; } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/junit/JUnitTestCase.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000028/AB0952363AC40CBFE034080020E8C54E.21 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000028/AB0952363AC40CBFE034080020E8C54E.21 Fri Oct 13 14:13:14 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/junit/JUnitTestCase.java Tue Oct 17 08:46:20 2006 *************** *** 25,30 **** --- 25,31 ---- import java.util.Map; import java.util.HashMap; + import java.util.Hashtable; import java.util.Properties; import java.net.URL; import junit.framework.*; *************** *** 53,59 **** public static Map propertiesMap = null; public static Map persistencePropertiesTestMap = new HashMap(); private static EntityManagerFactory emf = null; ! private static EntityManagerFactory emfNamedPersistenceUnit = null; static { // These following properties used for property processing testing. --- 54,60 ---- public static Map propertiesMap = null; public static Map persistencePropertiesTestMap = new HashMap(); private static EntityManagerFactory emf = null; ! private static Map emfNamedPersistenceUnits = null; static { // These following properties used for property processing testing. *************** *** 64,69 **** --- 65,71 ---- persistencePropertiesTestMap.put(TopLinkProperties.JDBC_WRITE_CONNECTIONS_MAX, "9"); persistencePropertiesTestMap.put(TopLinkProperties.JDBC_READ_CONNECTIONS_MIN, "4"); persistencePropertiesTestMap.put(TopLinkProperties.JDBC_READ_CONNECTIONS_MAX, "4"); + emfNamedPersistenceUnits = new Hashtable(); } public JUnitTestCase() { *************** *** 138,152 **** } public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName){ ! if (emfNamedPersistenceUnit == null){ ! emfNamedPersistenceUnit = Persistence.createEntityManagerFactory(persistenceUnitName, getDatabaseProperties()); ! } ! return emfNamedPersistenceUnit; } public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName, Map properties){ if (emfNamedPersistenceUnit == null){ emfNamedPersistenceUnit = Persistence.createEntityManagerFactory(persistenceUnitName, properties); } return emfNamedPersistenceUnit; } --- 140,153 ---- } public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName){ ! return getEntityManagerFactory(persistenceUnitName, getDatabaseProperties()); } public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName, Map properties){ + EntityManagerFactory emfNamedPersistenceUnit = (EntityManagerFactory)emfNamedPersistenceUnits.get("persistenceUnitName"); if (emfNamedPersistenceUnit == null){ emfNamedPersistenceUnit = Persistence.createEntityManagerFactory(persistenceUnitName, properties); + emfNamedPersistenceUnits.put(persistenceUnitName, emfNamedPersistenceUnit); } return emfNamedPersistenceUnit; } *************** *** 162,171 **** return emf != null && emf.isOpen(); } - public static boolean doesEntityManagerFactoryNamedPersistenceUnitExist() { - return emfNamedPersistenceUnit != null && emfNamedPersistenceUnit.isOpen(); - } - public static void closeEntityManagerFactory() { if(emf != null) { if(emf.isOpen()) { --- 163,168 ---- *************** *** 175,181 **** } } ! public static void closeEntityManagerFactoryNamedPersistenceUnit() { if(emfNamedPersistenceUnit != null) { if(emfNamedPersistenceUnit.isOpen()) { emfNamedPersistenceUnit.close(); --- 172,179 ---- } } ! public static void closeEntityManagerFactoryNamedPersistenceUnit(String persistenceUnitName) { ! EntityManagerFactory emfNamedPersistenceUnit = (EntityManagerFactory)emfNamedPersistenceUnits.get("persistenceUnitName"); if(emfNamedPersistenceUnit != null) { if(emfNamedPersistenceUnit.isOpen()) { emfNamedPersistenceUnit.close(); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/advanced/Employee.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000029/AB0952363AC40CBFE034080020E8C54E.20 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000029/AB0952363AC40CBFE034080020E8C54E.20 Fri Oct 13 14:13:40 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/advanced/Employee.java Tue Oct 17 08:46:20 2006 *************** *** 298,301 **** --- 298,305 ---- public String getAnEmptyString() { return ""; } + + public void setAddressField(Address address){ + this.address = address; + } } ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/JoinedAttributeAdvancedJunitTest.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000030/AB0952363AC40CBFE034080020E8C54E.6 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000030/AB0952363AC40CBFE034080020E8C54E.6 Fri Oct 13 14:14:41 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/JoinedAttributeAdvancedJunitTest.java Tue Oct 17 08:46:20 2006 *************** *** 790,799 **** ((Employee)iterator.next()).getAddress(); } - if (!addr.getId().equals(emp.getAddress().getId())){ - System.out.println("StopHere id's are not same"); - } - getDbSession().getIdentityMapAccessor().initializeAllIdentityMaps(); ReportQuery query = new ReportQuery(); --- 790,795 ---- ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/EntityManagerJUnitTestSuite.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000031/AB0952363AC40CBFE034080020E8C54E.53 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000031/AB0952363AC40CBFE034080020E8C54E.53 Fri Oct 13 14:14:44 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/EntityManagerJUnitTestSuite.java Tue Oct 17 08:46:20 2006 *************** *** 2692,2697 **** --- 2692,2899 ---- em.close(); } + /** + * Bug 801 + * Test to ensure when property access is used and the underlying variable is changed the change + * is correctly reflected in the database + * + * In this test we test making the change before the object is managed + */ + public void testInitializeFieldForPropertyAccess(){ + Employee employee = new Employee(); + employee.setFirstName("Andy"); + employee.setLastName("Dufresne"); + Address address = new Address(); + address.setCity("Shawshank"); + employee.setAddressField(address); + + EntityManager em = createEntityManager(); + em.getTransaction().begin(); + em.persist(employee); + try{ + em.getTransaction().commit(); + } catch (Exception e){ + em.getTransaction().rollback(); + } + int id = employee.getId(); + + clearCache(); + + employee = (Employee)em.find(Employee.class, new Integer(id)); + address = employee.getAddress(); + + assertTrue("The address was not persisted.", employee.getAddress() != null); + assertTrue("The address was not correctly persisted.", employee.getAddress().getCity().equals("Shawshank")); + + em.getTransaction().begin(); + employee.setAddress(null); + em.remove(address); + em.remove(employee); + em.getTransaction().commit(); + + } + + /** + * Bug 801 + * Test to ensure when property access is used and the underlying variable is changed the change + * is correctly reflected in the database + * + * In this test we test making the change after the object is managed + */ + public void testSetFieldForPropertyAccess(){ + EntityManager em = createEntityManager(); + + Employee employee = new Employee(); + employee.setFirstName("Andy"); + employee.setLastName("Dufresne"); + Address address = new Address(); + address.setCity("Shawshank"); + employee.setAddress(address); + + em.getTransaction().begin(); + em.persist(employee); + em.getTransaction().commit(); + int id = employee.getId(); + int addressId = address.getId(); + + em.getTransaction().begin(); + employee = (Employee)em.find(Employee.class, new Integer(id)); + employee.getAddress(); + + address = new Address(); + address.setCity("Metropolis"); + employee.setAddressField(address); + try{ + em.getTransaction().commit(); + } catch (Exception e){ + em.getTransaction().rollback(); + } + + clearCache(); + + employee = (Employee)em.find(Employee.class, new Integer(id)); + address = employee.getAddress(); + + assertTrue("The address was not persisted.", employee.getAddress() != null); + assertTrue("The address was not correctly persisted.", employee.getAddress().getCity().equals("Metropolis")); + + Address initialAddress = (Address)em.find(Address.class, new Integer(addressId)); + em.getTransaction().begin(); + employee.setAddress(null); + em.remove(address); + em.remove(employee); + em.remove(initialAddress); + em.getTransaction().commit(); + } + + /** + * Bug 801 + * Test to ensure when property access is used and the underlying variable is changed the change + * is correctly reflected in the database + * + * In this test we test making the change after the object is refreshed + */ + public void testSetFieldForPropertyAccessWithRefresh(){ + EntityManager em = createEntityManager(); + + Employee employee = new Employee(); + employee.setFirstName("Andy"); + employee.setLastName("Dufresne"); + Address address = new Address(); + address.setCity("Shawshank"); + employee.setAddress(address); + + em.getTransaction().begin(); + em.persist(employee); + em.getTransaction().commit(); + int id = employee.getId(); + int addressId = address.getId(); + + em.getTransaction().begin(); + em.refresh(employee); + employee.getAddress(); + + address = new Address(); + address.setCity("Metropolis"); + employee.setAddressField(address); + try{ + em.getTransaction().commit(); + } catch (Exception e){ + em.getTransaction().rollback(); + } + + clearCache(); + + employee = (Employee)em.find(Employee.class, new Integer(id)); + address = employee.getAddress(); + + assertTrue("The address was not persisted.", employee.getAddress() != null); + assertTrue("The address was not correctly persisted.", employee.getAddress().getCity().equals("Metropolis")); + + Address initialAddress = (Address)em.find(Address.class, new Integer(addressId)); + em.getTransaction().begin(); + employee.setAddress(null); + em.remove(address); + em.remove(employee); + em.remove(initialAddress); + em.getTransaction().commit(); + } + + /** + * Bug 801 + * Test to ensure when property access is used and the underlying variable is changed the change + * is correctly reflected in the database + * + * In this test we test making the change when an existing object is read into a new EM + */ + public void testSetFieldForPropertyAccessWithNewEM(){ + EntityManager em = createEntityManager(); + + Employee employee = new Employee(); + employee.setFirstName("Andy"); + employee.setLastName("Dufresne"); + Address address = new Address(); + address.setCity("Shawshank"); + employee.setAddress(address); + + em.getTransaction().begin(); + em.persist(employee); + em.getTransaction().commit(); + int id = employee.getId(); + int addressId = address.getId(); + + em = createEntityManager(); + + em.getTransaction().begin(); + employee = em.find(Employee.class, new Integer(id)); + employee.getAddress(); + + address = new Address(); + address.setCity("Metropolis"); + employee.setAddressField(address); + try{ + em.getTransaction().commit(); + } catch (Exception e){ + em.getTransaction().rollback(); + } + + clearCache(); + + employee = (Employee)em.find(Employee.class, new Integer(id)); + address = employee.getAddress(); + + assertTrue("The address was not persisted.", employee.getAddress() != null); + assertTrue("The address was not correctly persisted.", employee.getAddress().getCity().equals("Metropolis")); + + Address initialAddress = (Address)em.find(Address.class, new Integer(addressId)); + em.getTransaction().begin(); + employee.setAddress(null); + em.remove(address); + em.remove(employee); + em.remove(initialAddress); + em.getTransaction().commit(); + } + public static void main(String[] args) { // Now run JUnit. junit.swingui.TestRunner.main(args); ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/validation/ValidationTestSuite.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000032/AB0952363AC40CBFE034080020E8C54E.6 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000032/AB0952363AC40CBFE034080020E8C54E.6 Fri Oct 13 14:14:59 2006 --- /ade/tware_toplink10i/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/validation/ValidationTestSuite.java Tue Oct 17 08:46:20 2006 *************** *** 18,24 **** * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.testing.tests.cmp3.validation; import java.util.HashMap; --- 18,24 ---- * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] */ ! // Copyright (c) 1998, 2006, Oracle. All rights reserved. package oracle.toplink.essentials.testing.tests.cmp3.validation; import java.util.HashMap; *************** *** 68,74 **** // Ensure this is done to avoid consecutive tests picking up our // very specific isolated persistence unit. ! this.closeEntityManagerFactoryNamedPersistenceUnit(); } /** --- 68,74 ---- // Ensure this is done to avoid consecutive tests picking up our // very specific isolated persistence unit. ! this.closeEntityManagerFactoryNamedPersistenceUnit("isolated1053"); } /** *************** *** 84,90 **** // Ensure this is done to avoid consecutive tests picking up our // very specific isolated persistence unit. ! this.closeEntityManagerFactoryNamedPersistenceUnit(); } public void testPKClassTypeValidation(){ --- 84,90 ---- // Ensure this is done to avoid consecutive tests picking up our // very specific isolated persistence unit. ! this.closeEntityManagerFactoryNamedPersistenceUnit("isolated1053"); } public void testPKClassTypeValidation(){ ================================================================================ Merge Diffs: /ade/tware_toplink10i/tltest/source/essentials/oracle/toplink/essentials/testing/tests/weaving/RelationshipWeaverTestSuite.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000033/AB0952363AC40CBFE034080020E8C54E.14 Report generated at Tue Oct 17 08:59:23 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/tware/tware_10essentials_gf801_weaving_properties_061013/ade_storage/000033/AB0952363AC40CBFE034080020E8C54E.14 Mon Oct 16 14:46:29 2006 --- /ade/tware_toplink10i/tltest/source/essentials/oracle/toplink/essentials/testing/tests/weaving/RelationshipWeaverTestSuite.java Tue Oct 17 08:46:20 2006 *************** *** 15,20 **** --- 15,21 ---- import oracle.toplink.essentials.sessions.DatabaseLogin; import oracle.toplink.essentials.sessions.Project; import oracle.toplink.essentials.indirection.ValueHolderInterface; + import oracle.toplink.essentials.indirection.WeavedAttributeValueHolderInterface; import oracle.toplink.essentials.internal.weaving.*; import oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor; *************** *** 115,121 **** } assertNotNull("Weaved Order class does not have '_toplink_item_vh' field", f); assertSame("Weaved Order class' '_toplink_item_vh' field is not a ValueHolder", ! ValueHolderInterface.class, f.getType()); // check that Order's 'customer' field is a ValueHolder f = null; try { --- 116,122 ---- } assertNotNull("Weaved Order class does not have '_toplink_item_vh' field", f); assertSame("Weaved Order class' '_toplink_item_vh' field is not a ValueHolder", ! WeavedAttributeValueHolderInterface.class, f.getType()); // check that Order's 'customer' field is a ValueHolder f = null; try { *************** *** 126,132 **** } assertNotNull("Weaved Order class does not have '_toplink_customer_vh' field", f); assertSame("Weaved Order class' '_toplink_customer_vh' field is not a ValueHolder", ! ValueHolderInterface.class, f.getType()); } /* --- 127,133 ---- } assertNotNull("Weaved Order class does not have '_toplink_customer_vh' field", f); assertSame("Weaved Order class' '_toplink_customer_vh' field is not a ValueHolder", ! WeavedAttributeValueHolderInterface.class, f.getType()); } /*