/** * INTERNAL: * Builds a shallow original object. Only direct attributes and primary * keys are populated. In this way the minimum original required for * instantiating a working copy clone can be built without placing it in * the shared cache (no concern over cycles). * @parameter original later the input to buildCloneFromRow */ public void buildShallowOriginalFromRow(AbstractRecord record, Object original, JoinedAttributeManager joinManager, ObjectBuildingQuery query, AbstractSession executionSession) { // In this case we know it is a primary key mapping, so hope that it // is essentially a direct mapping. If it is a 1-1 with a // no-indirection pointer back to original, then will get a stack // overflow. // Only solution to this is to trigger the transformation using the root // session. UnitOfWorkImpl unitOfWork = (UnitOfWorkImpl)query.getSession(); query.setSession(unitOfWork.getParent()); try { readFromRowIntoObject(record, joinManager, original, query, executionSession); } finally { query.setSession(unitOfWork); } }
/** * INTERNAL: * Builds a shallow original object. Only direct attributes and primary * keys are populated. In this way the minimum original required for * instantiating a working copy clone can be built without placing it in * the shared cache (no concern over cycles). * @param original later the input to buildCloneFromRow */ @Override public void buildShallowOriginalFromRow(AbstractRecord record, Object original, JoinedAttributeManager joinManager, ObjectBuildingQuery query, AbstractSession executionSession) { // In this case we know it is a primary key mapping, so hope that it // is essentially a direct mapping. If it is a 1-1 with a // no-indirection pointer back to original, then will get a stack // overflow. // Only solution to this is to trigger the transformation using the root // session. UnitOfWorkImpl unitOfWork = (UnitOfWorkImpl)query.getSession(); query.setSession(unitOfWork.getParent()); try { readFromRowIntoObject(record, joinManager, original, null, query, executionSession, false); } finally { query.setSession(unitOfWork); } }
/** * INTERNAL: * Builds a shallow original object. Only direct attributes and primary * keys are populated. In this way the minimum original required for * instantiating a working copy clone can be built without placing it in * the shared cache (no concern over cycles). * @param original later the input to buildCloneFromRow */ @Override public void buildShallowOriginalFromRow(AbstractRecord record, Object original, JoinedAttributeManager joinManager, ObjectBuildingQuery query, AbstractSession executionSession) { // In this case we know it is a primary key mapping, so hope that it // is essentially a direct mapping. If it is a 1-1 with a // no-indirection pointer back to original, then will get a stack // overflow. // Only solution to this is to trigger the transformation using the root // session. UnitOfWorkImpl unitOfWork = (UnitOfWorkImpl)query.getSession(); query.setSession(unitOfWork.getParent()); try { readFromRowIntoObject(record, joinManager, original, null, query, executionSession, false); } finally { query.setSession(unitOfWork); } }
/** * INTERNAL: * Create an instance of the Key object from the key information extracted from the map. * This key object may be a shallow stub of the actual object if the key is an Entity type. */ public Object createStubbedMapComponentFromSerializableKeyInfo(Object keyInfo, AbstractSession session) { ObjectBuilder builder = this.referenceDescriptor.getObjectBuilder(); ObjectBuildingQuery clonedQuery = (ObjectBuildingQuery) getSelectionQuery().clone(); clonedQuery.setSession(session); Object newObject = referenceDescriptor.getInstantiationPolicy().buildNewInstance(); builder.buildPrimaryKeyAttributesIntoObject(newObject, builder.buildRowFromPrimaryKeyValues(keyInfo, session), clonedQuery, session); return newObject; }
/** * INTERNAL: * Create an instance of the Key object from the key information extracted from the map. * This key object may be a shallow stub of the actual object if the key is an Entity type. */ public Object createStubbedMapComponentFromSerializableKeyInfo(Object keyInfo, AbstractSession session) { ObjectBuilder builder = this.referenceDescriptor.getObjectBuilder(); ObjectBuildingQuery clonedQuery = (ObjectBuildingQuery) getSelectionQuery().clone(); clonedQuery.setSession(session); Object newObject = referenceDescriptor.getInstantiationPolicy().buildNewInstance(); builder.buildPrimaryKeyAttributesIntoObject(newObject, builder.buildRowFromPrimaryKeyValues(keyInfo, session), clonedQuery, session); return newObject; }
query.setSession(session); if (session.isUnitOfWork()) { original = buildObjectInUnitOfWork(query, joinManager, databaseRow, (UnitOfWorkImpl)session, primaryKey, concreteDescriptor); query.setSession(unitOfWork);
query.setSession(session); if (session.isUnitOfWork()) { } finally { unitOfWorkCacheKey.release(); query.setSession(unitOfWork);
query.setSession(session); if (session.isUnitOfWork()) { } finally { unitOfWorkCacheKey.release(); query.setSession(unitOfWork);