================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/essentials/oracle/toplink/essentials/testing/tests/cmp3/relationships/CMP3RelationshipsTestModel.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.6
Report generated at Mon Sep 18 10:37:00 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.6 Thu Sep 14 14:27:47 2006
--- /ade/gpelleti_main/tltest/source/essentials/oracle/toplink/essentials/testing/tests/cmp3/relationships/CMP3RelationshipsTestModel.java Mon Sep 18 10:36:59 2006
***************
*** 26,31 ****
--- 26,32 ----
addTest(new NamedQueryWithArgumentsTest());
addTests(JUnitTestCase.suite(EMQueryJUnitTestSuite.class));
addTests(JUnitTestCase.suite(ExpressionJUnitTestSuite.class));
+ addTests(JUnitTestCase.suite(IsolatedCacheTestSuite.class));
}
}
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/resource/essentials/ejb30-testing/META-INF/persistence.xml vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000003/AB0952363AC40CBFE034080020E8C54E.48
Report generated at Mon Sep 18 10:37:00 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000003/AB0952363AC40CBFE034080020E8C54E.48 Thu Sep 14 14:59:47 2006
--- /ade/gpelleti_main/tltest/resource/essentials/ejb30-testing/META-INF/persistence.xml Mon Sep 18 10:37:00 2006
***************
*** 40,48 ****
!
--- 40,49 ----
!
+
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/relationships/RelationshipsTableManager.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.6
Report generated at Mon Sep 18 10:37:00 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.6 Thu Sep 14 16:15:39 2006
--- /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/relationships/RelationshipsTableManager.java Mon Sep 18 10:37:00 2006
***************
*** 33,38 ****
--- 33,39 ----
setName("Relationships");
addTableDefinition(buildCMP3_CUSTOMERTable());
addTableDefinition(buildCMP3_ITEMTable());
+ addTableDefinition(buildCMP3_ISOLATEDITEMTable());
addTableDefinition(buildCMP3_ORDERTable());
addTableDefinition(buildCMP3_ORDER_SEQTable());
addTableDefinition(buildCMP3_SALESPERSONTable());
***************
*** 95,100 ****
--- 96,141 ----
return table;
}
+ public static TableDefinition buildCMP3_ISOLATEDITEMTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_ISOLATED_ITEM");
+
+ FieldDefinition fieldDESCRIPTION = new FieldDefinition();
+ fieldDESCRIPTION.setName("DESCRIPTION");
+ fieldDESCRIPTION.setTypeName("VARCHAR2");
+ fieldDESCRIPTION.setSize(80);
+ fieldDESCRIPTION.setSubSize(0);
+ fieldDESCRIPTION.setIsPrimaryKey(false);
+ fieldDESCRIPTION.setIsIdentity(false);
+ fieldDESCRIPTION.setUnique(false);
+ fieldDESCRIPTION.setShouldAllowNull(true);
+ table.addField(fieldDESCRIPTION);
+
+ FieldDefinition fieldITEM_ID = new FieldDefinition();
+ fieldITEM_ID.setName("ID");
+ fieldITEM_ID.setTypeName("NUMBER");
+ fieldITEM_ID.setSize(15);
+ fieldITEM_ID.setSubSize(0);
+ fieldITEM_ID.setIsPrimaryKey(true);
+ fieldITEM_ID.setIsIdentity(false);
+ fieldITEM_ID.setUnique(false);
+ fieldITEM_ID.setShouldAllowNull(false);
+ table.addField(fieldITEM_ID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR2");
+ fieldNAME.setSize(80);
+ fieldNAME.setSubSize(0);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ return table;
+ }
+
public static TableDefinition buildCMP3_ITEMTable() {
TableDefinition table = new TableDefinition();
table.setName("CMP3_ITEM");
================================================================================
Merge Diffs: /ade/gpelleti_main/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/base/EntityManagerImpl.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000007/AB0952363AC40CBFE034080020E8C54E.41
Report generated at Mon Sep 18 10:37:00 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000007/AB0952363AC40CBFE034080020E8C54E.41 Fri Sep 15 13:45:29 2006
--- /ade/gpelleti_main/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/base/EntityManagerImpl.java Mon Sep 18 10:37:00 2006
***************
*** 36,41 ****
--- 36,42 ----
import oracle.toplink.essentials.expressions.Expression;
import oracle.toplink.essentials.internal.ejb.cmp3.transaction.base.TransactionWrapperImpl;
import oracle.toplink.essentials.internal.localization.ExceptionLocalization;
+ import oracle.toplink.essentials.internal.sessions.IsolatedClientSession;
import oracle.toplink.essentials.internal.sessions.MergeManager;
import oracle.toplink.essentials.internal.helper.IdentityHashtable;
import oracle.toplink.essentials.internal.descriptors.OptimisticLockingPolicy;
***************
*** 146,151 ****
--- 147,156 ----
if (this.extendedPersistenceContext != null) {
if (checkForTransaction(false) != null){
this.extendedPersistenceContext.clear();
+
+ if (this.extendedPersistenceContext.getParent() instanceof IsolatedClientSession) {
+ this.extendedPersistenceContext.getParent().getIdentityMapAccessor().initializeIdentityMaps();
+ }
}else{
this.extendedPersistenceContext = null;
}
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/relationships/IsolatedItem.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000009/AB0952363AC40CBFE034080020E8C54E.0
Report generated at Mon Sep 18 10:37:00 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000009/AB0952363AC40CBFE034080020E8C54E.0 Mon Sep 18 10:35:28 2006
--- /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/relationships/IsolatedItem.java Mon Sep 18 10:35:27 2006
***************
*** 0 ****
--- 1,69 ----
+ /*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
+ */
+ // Copyright (c) 1998, 2006, Oracle. All rights reserved.
+ package oracle.toplink.essentials.testing.models.cmp3.relationships;
+
+ import javax.persistence.*;
+ import static javax.persistence.GenerationType.*;
+
+ @Entity
+ @Table(name="CMP3_ISOLATED_ITEM")
+ public class IsolatedItem implements java.io.Serializable {
+ private Integer itemId;
+ private String name;
+ private String description;
+
+ public IsolatedItem() {}
+
+ @Id
+ @GeneratedValue(strategy=TABLE, generator="ISOLATED_ITEM_TABLE_GENERATOR")
+ @TableGenerator(
+ name="ISOLATED_ITEM_TABLE_GENERATOR",
+ table="CMP3_CUSTOMER_SEQ",
+ pkColumnName="SEQ_NAME",
+ valueColumnName="SEQ_COUNT",
+ pkColumnValue="ISOLATED_ITEM_SEQ"
+ )
+ @Column(name="ID")
+ public Integer getItemId() {
+ return itemId;
+ }
+
+ public void setItemId(Integer id) {
+ this.itemId = id;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String desc) {
+ this.description = desc;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ }
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/relationships/IsolatedCacheTestSuite.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000011/AB0952363AC40CBFE034080020E8C54E.0
Report generated at Mon Sep 18 10:37:00 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000011/AB0952363AC40CBFE034080020E8C54E.0 Mon Sep 18 10:35:32 2006
--- /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/relationships/IsolatedCacheTestSuite.java Mon Sep 18 10:35:32 2006
***************
*** 0 ****
--- 1,81 ----
+ /*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * 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.relationships;
+
+ import junit.framework.Test;
+ import junit.framework.TestSuite;
+
+ import javax.persistence.*;
+
+ import oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl;
+ import oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork;
+ import oracle.toplink.essentials.testing.framework.junit.JUnitTestCase;
+ import oracle.toplink.essentials.testing.models.cmp3.relationships.IsolatedItem;
+
+ import oracle.toplink.essentials.testing.models.cmp3.relationships.*;
+
+ public class IsolatedCacheTestSuite extends JUnitTestCase {
+ public IsolatedCacheTestSuite() {}
+
+ public IsolatedCacheTestSuite(String name) {
+ super(name);
+ }
+
+ public void setUp () {
+ super.setUp();
+ new RelationshipsTableManager().replaceTables(JUnitTestCase.getServerSession());
+ }
+
+ public static Test suite() {
+ return new TestSuite(IsolatedCacheTestSuite.class) {
+ protected void setUp(){}
+ protected void tearDown(){}
+ };
+ }
+
+ public void testCacheIsolationDBQueryHit() throws Exception {
+ EntityManager em = createEntityManager();
+
+ // Step 1 - get an isolated item in the cache.
+ em.getTransaction().begin();
+
+ IsolatedItem item = new IsolatedItem();
+ item.setDescription("A phoney item");
+ item.setName("Phoney name");
+ em.persist(item);
+
+ em.getTransaction().commit();
+
+ // Step 2 - clear the entity manager and see if the item still exists
+ // in the uow cache.
+ em.getTransaction().begin();
+
+ em.clear();
+ RepeatableWriteUnitOfWork uow = (RepeatableWriteUnitOfWork) ((EntityManagerImpl) em.getDelegate()).getActivePersistenceContext(em.getTransaction());
+
+ assertFalse("The isolated item was not cleared from the shared cache", uow.getIdentityMapAccessor().containsObjectInIdentityMap(item));
+ assertFalse("The isolated item was not cleared from the uow cache", uow.getParent().getIdentityMapAccessor().containsObjectInIdentityMap(item));
+
+ em.getTransaction().commit();
+ em.close();
+ }
+ }
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/essentials/oracle/toplink/essentials/testing/tests/cmp3/relationships/CMP3RelationshipsTestModel.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.6
Report generated at Mon Sep 25 13:55:11 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.6 Thu Sep 14 14:27:47 2006
--- /ade/gpelleti_main/tltest/source/essentials/oracle/toplink/essentials/testing/tests/cmp3/relationships/CMP3RelationshipsTestModel.java Mon Sep 25 13:55:11 2006
***************
*** 26,31 ****
--- 26,32 ----
addTest(new NamedQueryWithArgumentsTest());
addTests(JUnitTestCase.suite(EMQueryJUnitTestSuite.class));
addTests(JUnitTestCase.suite(ExpressionJUnitTestSuite.class));
+ addTests(JUnitTestCase.suite(IsolatedCacheTestSuite.class));
}
}
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/resource/essentials/ejb30-testing/META-INF/persistence.xml vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000003/AB0952363AC40CBFE034080020E8C54E.48
Report generated at Mon Sep 25 13:55:11 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000003/AB0952363AC40CBFE034080020E8C54E.48 Thu Sep 14 14:59:47 2006
--- /ade/gpelleti_main/tltest/resource/essentials/ejb30-testing/META-INF/persistence.xml Mon Sep 25 13:55:11 2006
***************
*** 37,46 ****
!
--- 37,47 ----
+
!
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/relationships/RelationshipsTableManager.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.6
Report generated at Mon Sep 25 13:55:11 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.6 Thu Sep 14 16:15:39 2006
--- /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/relationships/RelationshipsTableManager.java Mon Sep 25 13:55:11 2006
***************
*** 33,38 ****
--- 33,39 ----
setName("Relationships");
addTableDefinition(buildCMP3_CUSTOMERTable());
addTableDefinition(buildCMP3_ITEMTable());
+ addTableDefinition(buildCMP3_ISOLATEDITEMTable());
addTableDefinition(buildCMP3_ORDERTable());
addTableDefinition(buildCMP3_ORDER_SEQTable());
addTableDefinition(buildCMP3_SALESPERSONTable());
***************
*** 95,100 ****
--- 96,141 ----
return table;
}
+ public static TableDefinition buildCMP3_ISOLATEDITEMTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_ISOLATED_ITEM");
+
+ FieldDefinition fieldDESCRIPTION = new FieldDefinition();
+ fieldDESCRIPTION.setName("DESCRIPTION");
+ fieldDESCRIPTION.setTypeName("VARCHAR2");
+ fieldDESCRIPTION.setSize(80);
+ fieldDESCRIPTION.setSubSize(0);
+ fieldDESCRIPTION.setIsPrimaryKey(false);
+ fieldDESCRIPTION.setIsIdentity(false);
+ fieldDESCRIPTION.setUnique(false);
+ fieldDESCRIPTION.setShouldAllowNull(true);
+ table.addField(fieldDESCRIPTION);
+
+ FieldDefinition fieldITEM_ID = new FieldDefinition();
+ fieldITEM_ID.setName("ID");
+ fieldITEM_ID.setTypeName("NUMBER");
+ fieldITEM_ID.setSize(15);
+ fieldITEM_ID.setSubSize(0);
+ fieldITEM_ID.setIsPrimaryKey(true);
+ fieldITEM_ID.setIsIdentity(false);
+ fieldITEM_ID.setUnique(false);
+ fieldITEM_ID.setShouldAllowNull(false);
+ table.addField(fieldITEM_ID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR2");
+ fieldNAME.setSize(80);
+ fieldNAME.setSubSize(0);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ return table;
+ }
+
public static TableDefinition buildCMP3_ITEMTable() {
TableDefinition table = new TableDefinition();
table.setName("CMP3_ITEM");
================================================================================
Merge Diffs: /ade/gpelleti_main/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/base/EntityManagerImpl.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000007/AB0952363AC40CBFE034080020E8C54E.41
Report generated at Mon Sep 25 13:55:11 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000007/AB0952363AC40CBFE034080020E8C54E.41 Fri Sep 15 13:45:29 2006
--- /ade/gpelleti_main/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/base/EntityManagerImpl.java Mon Sep 25 13:55:11 2006
***************
*** 36,41 ****
--- 36,42 ----
import oracle.toplink.essentials.expressions.Expression;
import oracle.toplink.essentials.internal.ejb.cmp3.transaction.base.TransactionWrapperImpl;
import oracle.toplink.essentials.internal.localization.ExceptionLocalization;
+ import oracle.toplink.essentials.internal.sessions.IsolatedClientSession;
import oracle.toplink.essentials.internal.sessions.MergeManager;
import oracle.toplink.essentials.internal.helper.IdentityHashtable;
import oracle.toplink.essentials.internal.descriptors.OptimisticLockingPolicy;
***************
*** 146,151 ****
--- 147,156 ----
if (this.extendedPersistenceContext != null) {
if (checkForTransaction(false) != null){
this.extendedPersistenceContext.clear();
+
+ if (this.extendedPersistenceContext.getParent() instanceof IsolatedClientSession) {
+ this.extendedPersistenceContext.getParent().getIdentityMapAccessor().initializeIdentityMaps();
+ }
}else{
this.extendedPersistenceContext = null;
}
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/relationships/IsolatedItem.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000009/AB0952363AC40CBFE034080020E8C54E.0
Report generated at Mon Sep 25 13:55:11 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000009/AB0952363AC40CBFE034080020E8C54E.0 Mon Sep 18 10:35:28 2006
--- /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/relationships/IsolatedItem.java Mon Sep 25 13:54:19 2006
***************
*** 0 ****
--- 1,69 ----
+ /*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
+ */
+ // Copyright (c) 1998, 2006, Oracle. All rights reserved.
+ package oracle.toplink.essentials.testing.models.cmp3.relationships;
+
+ import javax.persistence.*;
+ import static javax.persistence.GenerationType.*;
+
+ @Entity
+ @Table(name="CMP3_ISOLATED_ITEM")
+ public class IsolatedItem implements java.io.Serializable {
+ private Integer itemId;
+ private String name;
+ private String description;
+
+ public IsolatedItem() {}
+
+ @Id
+ @GeneratedValue(strategy=TABLE, generator="ISOLATED_ITEM_TABLE_GENERATOR")
+ @TableGenerator(
+ name="ISOLATED_ITEM_TABLE_GENERATOR",
+ table="CMP3_CUSTOMER_SEQ",
+ pkColumnName="SEQ_NAME",
+ valueColumnName="SEQ_COUNT",
+ pkColumnValue="ISOLATED_ITEM_SEQ"
+ )
+ @Column(name="ID")
+ public Integer getItemId() {
+ return itemId;
+ }
+
+ public void setItemId(Integer id) {
+ this.itemId = id;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String desc) {
+ this.description = desc;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ }
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/relationships/IsolatedCacheTestSuite.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000011/AB0952363AC40CBFE034080020E8C54E.0
Report generated at Mon Sep 25 13:55:11 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000011/AB0952363AC40CBFE034080020E8C54E.0 Mon Sep 18 10:35:32 2006
--- /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/relationships/IsolatedCacheTestSuite.java Mon Sep 25 13:54:23 2006
***************
*** 0 ****
--- 1,81 ----
+ /*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * 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.relationships;
+
+ import junit.framework.Test;
+ import junit.framework.TestSuite;
+
+ import javax.persistence.*;
+
+ import oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl;
+ import oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork;
+ import oracle.toplink.essentials.testing.framework.junit.JUnitTestCase;
+ import oracle.toplink.essentials.testing.models.cmp3.relationships.IsolatedItem;
+
+ import oracle.toplink.essentials.testing.models.cmp3.relationships.*;
+
+ public class IsolatedCacheTestSuite extends JUnitTestCase {
+ public IsolatedCacheTestSuite() {}
+
+ public IsolatedCacheTestSuite(String name) {
+ super(name);
+ }
+
+ public void setUp () {
+ super.setUp();
+ new RelationshipsTableManager().replaceTables(JUnitTestCase.getServerSession());
+ }
+
+ public static Test suite() {
+ return new TestSuite(IsolatedCacheTestSuite.class) {
+ protected void setUp(){}
+ protected void tearDown(){}
+ };
+ }
+
+ public void testCacheIsolationDBQueryHit() throws Exception {
+ EntityManager em = createEntityManager();
+
+ // Step 1 - get an isolated item in the cache.
+ em.getTransaction().begin();
+
+ IsolatedItem item = new IsolatedItem();
+ item.setDescription("A phoney item");
+ item.setName("Phoney name");
+ em.persist(item);
+
+ em.getTransaction().commit();
+
+ // Step 2 - clear the entity manager and see if the item still exists
+ // in the uow cache.
+ em.getTransaction().begin();
+
+ em.clear();
+ RepeatableWriteUnitOfWork uow = (RepeatableWriteUnitOfWork) ((EntityManagerImpl) em.getDelegate()).getActivePersistenceContext(em.getTransaction());
+
+ assertFalse("The isolated item was not cleared from the shared cache", uow.getIdentityMapAccessor().containsObjectInIdentityMap(item));
+ assertFalse("The isolated item was not cleared from the uow cache", uow.getParent().getIdentityMapAccessor().containsObjectInIdentityMap(item));
+
+ em.getTransaction().commit();
+ em.close();
+ }
+ }
================================================================================
Merge Diffs: /ade/gpelleti_main/tldev/source/essentials/oracle/toplink/essentials/internal/queryframework/ExpressionQueryMechanism.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000019/AB0952363AC40CBFE034080020E8C54E.27
Report generated at Mon Sep 25 13:55:11 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000019/AB0952363AC40CBFE034080020E8C54E.27 Fri Sep 22 15:57:55 2006
--- /ade/gpelleti_main/tldev/source/essentials/oracle/toplink/essentials/internal/queryframework/ExpressionQueryMechanism.java Mon Sep 25 13:55:11 2006
***************
*** 1001,1017 ****
SQLDeleteStatement deleteStatement;
- // Indicates which kind of sql call should be built:
- // the one containing "EXISTS" or the one containing "NOT EXISTS".
// In Employee example, query with reference class:
// Employee will build "EXISTS" for SALARY and "NOT EXISTS" for EMPLOYEE;
// LargeProject will build "EXISTS" for LPROJECT and "NOT EXISTS" for Project
! boolean useSelectCallForExist = !isSelectCallForNotExistRequired || table.equals((DatabaseTable)tablesInInsertOrder.lastElement());
! if(useSelectCallForExist) {
! // In Employee example, query with reference class:
! // Employee calls this for SALARY table;
! // LargeProject calls this for LPROJECT table;
deleteStatement = buildDeleteAllStatement(table, null, selectCallForExist, selectStatementForExist, null, null, primaryKeyFields);
} else {
if(inheritanceExpression == null) {
// In Employee example, query with reference class Employee calls this for EMPLOYEE table
--- 1001,1034 ----
SQLDeleteStatement deleteStatement;
// In Employee example, query with reference class:
// Employee will build "EXISTS" for SALARY and "NOT EXISTS" for EMPLOYEE;
// LargeProject will build "EXISTS" for LPROJECT and "NOT EXISTS" for Project
! // The situation a more complex if inheritance is involved
! if(!isSelectCallForNotExistRequired) {
deleteStatement = buildDeleteAllStatement(table, null, selectCallForExist, selectStatementForExist, null, null, primaryKeyFields);
+ } else if (table.equals((DatabaseTable)tablesInInsertOrder.lastElement())) {
+ if(inheritanceExpression == null) {
+ // In Employee example, query with reference class:
+ // Employee calls this for SALARY table;
+ deleteStatement = buildDeleteAllStatement(table, null, selectCallForExist, selectStatementForExist, null, null, primaryKeyFields);
+ } else {
+ if(table.equals(getDescriptor().getMultipleTableInsertOrder().firstElement())) {
+ deleteStatement = buildDeleteAllStatement(table, inheritanceExpression, selectCallForExist, selectStatementForExist, null, null, primaryKeyFields);
+ } else {
+ ClassDescriptor desc = getHighestDescriptorMappingTable(table);
+ if(desc == getDescriptor()) {
+ // In Employee example, query with reference class:
+ // LargeProject calls this for LPROJECT table;
+ deleteStatement = buildDeleteAllStatement(table, null, selectCallForExist, selectStatementForExist, null, null, primaryKeyFields);
+ } else {
+ SQLSelectStatement inheritanceSelectStatementForExist = createSQLSelectStatementForModifyAll(null, inheritanceExpression, desc);
+ SQLCall inheritanceSelectCallForExist = (SQLCall)inheritanceSelectStatementForExist.buildCall(getSession());
+
+ deleteStatement = buildDeleteAllStatement(table, null, inheritanceSelectCallForExist, inheritanceSelectStatementForExist, null, null, primaryKeyFields);
+ }
+ }
+ }
} else {
if(inheritanceExpression == null) {
// In Employee example, query with reference class Employee calls this for EMPLOYEE table
***************
*** 1024,1037 ****
// In Employee example, query with reference class LargeProject calls this for PROJECT table
deleteStatement = buildDeleteAllStatement(table, inheritanceExpression, null, null, selectCallForNotExist, selectStatementForNotExist, primaryKeyFields);
} else {
! // find the highest descriptor in inheritance hierarchy mapped to the table
! ClassDescriptor desc = getDescriptor();
! ClassDescriptor parentDescriptor = getDescriptor().getInheritancePolicy().getParentDescriptor();
! while(parentDescriptor.getTables().contains(table)) {
! desc = parentDescriptor;
! parentDescriptor = parentDescriptor.getInheritancePolicy().getParentDescriptor();
! }
!
if(desc == getDescriptor()) {
// Class has multiple tables that are not inherited.
// In extended Employee example:
--- 1041,1047 ----
// In Employee example, query with reference class LargeProject calls this for PROJECT table
deleteStatement = buildDeleteAllStatement(table, inheritanceExpression, null, null, selectCallForNotExist, selectStatementForNotExist, primaryKeyFields);
} else {
! ClassDescriptor desc = getHighestDescriptorMappingTable(table);
if(desc == getDescriptor()) {
// Class has multiple tables that are not inherited.
// In extended Employee example:
***************
*** 2158,2161 ****
--- 2168,2186 ----
public void setSelectionCriteria(Expression expression) {
this.selectionCriteria = expression;
}
+
+ /**
+ * Pass to this method a table mapped by query's descriptor.
+ * Returns the highest descriptor in inheritance hierarchy that mapps this table.
+ */
+ protected ClassDescriptor getHighestDescriptorMappingTable(DatabaseTable table) {
+ // find the highest descriptor in inheritance hierarchy mapped to the table
+ ClassDescriptor desc = getDescriptor();
+ ClassDescriptor parentDescriptor = getDescriptor().getInheritancePolicy().getParentDescriptor();
+ while(parentDescriptor != null && parentDescriptor.getTables().contains(table)) {
+ desc = parentDescriptor;
+ parentDescriptor = parentDescriptor.getInheritancePolicy().getParentDescriptor();
+ }
+ return desc;
+ }
}
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/inheritance/DeleteAllQueryInheritanceJunitTest.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000020/AB0952363AC40CBFE034080020E8C54E.8
Report generated at Mon Sep 25 13:55:11 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000020/AB0952363AC40CBFE034080020E8C54E.8 Mon Sep 25 13:14:51 2006
--- /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/inheritance/DeleteAllQueryInheritanceJunitTest.java Mon Sep 25 13:55:11 2006
***************
*** 118,156 ****
// JUnit framework will automatically execute all methods starting with test...
// The test methods' name pattern is a word "test" followed by underscore and the used selectionExpression:
// test_selectionExpression
- // Each test will test DeleteAllQuery with the specified reference class
- // and all its subclasses
- // Example: for Vehicle.class 9 DeleteAllQueries will be tested.
// ALL Vehicles
public static void test_null() {
! deleteAllQueryInternal(Vehicle.class, null);
}
// ALL Vehicles - nondeferred (execute deleteAllQuery immediately as opposed to during uow.commit)
public static void test_nullNonDeferred() {
! deleteAllQueryInternalNonDeferred(Vehicle.class, null);
}
// Vehicles owned by TOP Company
public static void test_ownerTOP() {
ExpressionBuilder builder = new ExpressionBuilder();
Expression exp = builder.get("owner").get("name").equal("TOP");
! deleteAllQueryInternal(Vehicle.class, exp);
}
// FueledVehicles running on Petrol
public static void test_fuelTypePetrol() {
ExpressionBuilder builder = new ExpressionBuilder();
Expression exp = builder.get("fuelType").equalsIgnoreCase("Petrol");
! deleteAllQueryInternal(FueledVehicle.class, exp);
}
// shchool buses without drivers
public static void test_schoolBusNullDriver() {
ExpressionBuilder builder = new ExpressionBuilder();
Expression exp = builder.get("description").equalsIgnoreCase("School bus").and(builder.get("busDriver").isNull());
! deleteAllQueryInternal(Bus.class, exp);
}
// FueledVehicles owned by Companies that also own NonFueledVehicles
--- 118,153 ----
// JUnit framework will automatically execute all methods starting with test...
// The test methods' name pattern is a word "test" followed by underscore and the used selectionExpression:
// test_selectionExpression
// ALL Vehicles
public static void test_null() {
! deleteAllQueryInternal_Deferred_Children(Vehicle.class, null);
}
// ALL Vehicles - nondeferred (execute deleteAllQuery immediately as opposed to during uow.commit)
public static void test_nullNonDeferred() {
! deleteAllQueryInternal_NonDeferred_Children(Vehicle.class, null);
}
// Vehicles owned by TOP Company
public static void test_ownerTOP() {
ExpressionBuilder builder = new ExpressionBuilder();
Expression exp = builder.get("owner").get("name").equal("TOP");
! deleteAllQueryInternal_Deferred_Children(Vehicle.class, exp);
}
// FueledVehicles running on Petrol
public static void test_fuelTypePetrol() {
ExpressionBuilder builder = new ExpressionBuilder();
Expression exp = builder.get("fuelType").equalsIgnoreCase("Petrol");
! deleteAllQueryInternal_Deferred_Children(FueledVehicle.class, exp);
}
// shchool buses without drivers
public static void test_schoolBusNullDriver() {
ExpressionBuilder builder = new ExpressionBuilder();
Expression exp = builder.get("description").equalsIgnoreCase("School bus").and(builder.get("busDriver").isNull());
! deleteAllQueryInternal_Deferred_Children(Bus.class, exp);
}
// FueledVehicles owned by Companies that also own NonFueledVehicles
***************
*** 164,181 ****
rq.setSelectionCriteria(subExpression);
Expression exp = builder.exists(rq);
! deleteAllQueryInternal(FueledVehicle.class, exp);
}
! protected static void deleteAllQueryInternal(Class referenceClass, Expression selectionExpression) {
! String errorMsg = DeleteAllQueryTestHelper.execute(getDbSession(), referenceClass, selectionExpression);
! if(errorMsg != null) {
! fail(errorMsg);
! }
}
! protected static void deleteAllQueryInternalNonDeferred(Class referenceClass, Expression selectionExpression) {
! String errorMsg = DeleteAllQueryTestHelper.execute(getDbSession(), referenceClass, selectionExpression, false);
if(errorMsg != null) {
fail(errorMsg);
}
--- 161,197 ----
rq.setSelectionCriteria(subExpression);
Expression exp = builder.exists(rq);
! deleteAllQueryInternal_Deferred_Children(FueledVehicle.class, exp);
}
! protected static void deleteAllQueryInternal_Deferred_Children(Class referenceClass, Expression selectionExpression) {
! deleteAllQueryInternal(referenceClass, selectionExpression, true, true);
! }
!
! protected static void deleteAllQueryInternal_NonDeferred_Children(Class referenceClass, Expression selectionExpression) {
! deleteAllQueryInternal(referenceClass, selectionExpression, false, true);
}
! protected static void deleteAllQueryInternal_Deferred_NoChildren(Class referenceClass, Expression selectionExpression) {
! deleteAllQueryInternal(referenceClass, selectionExpression, true, false);
! }
!
! protected static void deleteAllQueryInternal_NonDeferred_NoChildren(Class referenceClass, Expression selectionExpression) {
! deleteAllQueryInternal(referenceClass, selectionExpression, false, false);
! }
!
! // referenceClass - the reference class of DeleteAllQuery to be tested
! // selectionExpression - selection expression of DeleteAllQuery to be tested
! // shouldDeferExecutionInUOW==true causes deferring query execution until uow.commit;
! // shouldDeferExecutionInUOW==false causes immediate query execution;
! // shouldHandleChildren==true means the test will be executed not only with the specified class,
! // but also with all its subclasses.
! // Each test will test DeleteAllQuery with the specified reference class
! // and all its subclasses
! // Example: for Vehicle.class 9 DeleteAllQueries will be tested.
! // shouldHandleChildren==false means the test will be executed with the specified class only.
! protected static void deleteAllQueryInternal(Class referenceClass, Expression selectionExpression, boolean shouldDeferExecutionInUOW, boolean handleChildren) {
! String errorMsg = DeleteAllQueryTestHelper.execute(getDbSession(), referenceClass, selectionExpression, shouldDeferExecutionInUOW, handleChildren);
if(errorMsg != null) {
fail(errorMsg);
}
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/DeleteAllQueryTestHelper.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000021/AB0952363AC40CBFE034080020E8C54E.5
Report generated at Mon Sep 25 13:55:11 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000021/AB0952363AC40CBFE034080020E8C54E.5 Mon Sep 25 13:15:08 2006
--- /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/DeleteAllQueryTestHelper.java Mon Sep 25 13:55:11 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;
***************
*** 27,38 ****
import java.util.Vector;
import oracle.toplink.essentials.expressions.Expression;
- import oracle.toplink.essentials.expressions.ExpressionBuilder;
import oracle.toplink.essentials.descriptors.ClassDescriptor;
import oracle.toplink.essentials.internal.sessions.AbstractSession;
import oracle.toplink.essentials.sessions.Session;
import oracle.toplink.essentials.queryframework.DeleteAllQuery;
- import oracle.toplink.essentials.queryframework.ReportQuery;
import oracle.toplink.essentials.sessions.UnitOfWork;
public class DeleteAllQueryTestHelper {
--- 27,36 ----
***************
*** 45,67 ****
return execute(mainSession, referenceClass, selectionExpression, shouldDeferExecutionInUOW, true);
}
public static String execute(Session mainSession, Class referenceClass, Expression selectionExpression, boolean shouldDeferExecutionInUOW, boolean handleChildren) {
- // define a ReportQuery that will be used to check which object left after deletion.
- // In case of inheritance the query will use the utmost parent as a reference class -
- // and will return only PKs.
Class rootClass = referenceClass;
ClassDescriptor descriptor = mainSession.getClassDescriptor(referenceClass);
if(descriptor.hasInheritance()) {
ClassDescriptor parentDescriptor = descriptor;
while(!parentDescriptor.getInheritancePolicy().isRootParentDescriptor()) {
! parentDescriptor = (ClassDescriptor) parentDescriptor.getInheritancePolicy().getParentDescriptor();
}
rootClass = parentDescriptor.getJavaClass();
}
! ReportQuery reportQuery = new ReportQuery(rootClass, new ExpressionBuilder());
! reportQuery.setShouldRetrievePrimaryKeys(true);
!
! String errorMsg = execute(mainSession, referenceClass, selectionExpression, shouldDeferExecutionInUOW, handleChildren, reportQuery);
if(errorMsg.length() == 0) {
return null;
--- 43,76 ----
return execute(mainSession, referenceClass, selectionExpression, shouldDeferExecutionInUOW, true);
}
+ // mainSession - the ServerSession used.
+ // referenceClass - the reference class of DeleteAllQuery to be tested
+ // selectionExpression - selection expression of DeleteAllQuery to be tested
+ // shouldDeferExecutionInUOW==true causes deferring query execution until uow.commit;
+ // shouldDeferExecutionInUOW==false causes immediate query execution;
+ // shouldHandleChildren==true means the test will be executed not only with the specified class,
+ // but also with all its subclasses.
+ // Each test will test DeleteAllQuery with the specified reference class
+ // and all its subclasses
+ // Example: for Vehicle.class 9 DeleteAllQueries will be tested.
+ // shouldHandleChildren==false means the test will be executed with the specified class only.
+ //
+ // For each DeleteAllQuery its results compared with one-by-one deletion:
+ // selectionCriteria is used to select objects and then delete them one-by-one (using uow.deleteObject);
+ // the results are saved and after compared with DeleteAllQuery results:
+ // both inCache and inDb comparison performed;
+ // both deleted and remained objects should be the same;
public static String execute(Session mainSession, Class referenceClass, Expression selectionExpression, boolean shouldDeferExecutionInUOW, boolean handleChildren) {
Class rootClass = referenceClass;
ClassDescriptor descriptor = mainSession.getClassDescriptor(referenceClass);
if(descriptor.hasInheritance()) {
ClassDescriptor parentDescriptor = descriptor;
while(!parentDescriptor.getInheritancePolicy().isRootParentDescriptor()) {
! parentDescriptor = parentDescriptor.getInheritancePolicy().getParentDescriptor();
}
rootClass = parentDescriptor.getJavaClass();
}
! String errorMsg = execute(mainSession, referenceClass, selectionExpression, shouldDeferExecutionInUOW, handleChildren, rootClass);
if(errorMsg.length() == 0) {
return null;
***************
*** 71,77 ****
}
protected static String execute(Session mainSession, Class referenceClass, Expression selectionExpression, boolean shouldDeferExecutionInUOW, boolean handleChildren,
! ReportQuery reportQuery) {
String errorMsg = "";
clearCache(mainSession);
--- 80,86 ----
}
protected static String execute(Session mainSession, Class referenceClass, Expression selectionExpression, boolean shouldDeferExecutionInUOW, boolean handleChildren,
! Class rootClass) {
String errorMsg = "";
clearCache(mainSession);
***************
*** 92,101 ****
mainSession.logMessage("***delete one by one");
uow.commit();
- // pk for the objects left after the original TopLink deletion - one buy one.
- Vector pkLeftAfterOriginalDeletion = (Vector)session.executeQuery(reportQuery);
- // objects left after the original TopLink deletion - one buy one.
- Class rootClass = reportQuery.getReferenceClass();
Vector objectsLeftAfterOriginalDeletion = session.readAllObjects(rootClass);
((AbstractSession)session).rollbackTransaction();
--- 101,106 ----
***************
*** 118,124 ****
DeleteAllQuery query = new DeleteAllQuery(referenceClass, selectionExpression);
query.setShouldDeferExecutionInUOW(shouldDeferExecutionInUOW);
uow.executeQuery(query);
! mainSession.logMessage("***DeleteAllQuery");
uow.commit();
// verify that cache invalidation worked correctly:
--- 123,129 ----
DeleteAllQuery query = new DeleteAllQuery(referenceClass, selectionExpression);
query.setShouldDeferExecutionInUOW(shouldDeferExecutionInUOW);
uow.executeQuery(query);
! mainSession.logMessage("***DeleteAllQuery for class " + referenceClass.getName());
uow.commit();
// verify that cache invalidation worked correctly:
***************
*** 127,152 ****
for(int i=0; i < objectsToDelete.size(); i++) {
Object deletedObject = session.readObject(objectsToDelete.elementAt(i));
if(deletedObject != null) {
! classErrorMsg = classErrorMsg + "Deleted object is stil in cache; ";
break;
}
}
for(int i=0; i < objectsLeftAfterOriginalDeletion.size(); i++) {
! Object remainingObject = session.readObject(objectsLeftAfterOriginalDeletion.elementAt(i));
! if(remainingObject == null) {
! classErrorMsg = classErrorMsg + "Remaining object is not in cache; ";
break;
}
}
! // pk for object left after DeleteAllQuery was executed.
! Vector pkLeftAfterDeleteAllQuery = (Vector)session.executeQuery(reportQuery);
((AbstractSession)session).rollbackTransaction();
- if(!pkLeftAfterOriginalDeletion.equals(pkLeftAfterDeleteAllQuery)) {
- classErrorMsg = "DeleteAllQuery and delete one-by-one results differ; " + classErrorMsg;
- }
if(classErrorMsg.length() > 0) {
String className = referenceClass.getName();
String shortClassName = className.substring(className.lastIndexOf('.') + 1);
--- 132,171 ----
for(int i=0; i < objectsToDelete.size(); i++) {
Object deletedObject = session.readObject(objectsToDelete.elementAt(i));
if(deletedObject != null) {
! classErrorMsg = classErrorMsg + "Deleted object "+ deletedObject +" is stil in cache; ";
break;
}
}
for(int i=0; i < objectsLeftAfterOriginalDeletion.size(); i++) {
! Object remainingObject = objectsLeftAfterOriginalDeletion.elementAt(i);
! Object remainingObjectRead = session.readObject(remainingObject);
! if(remainingObjectRead == null) {
! classErrorMsg = classErrorMsg + "Remaining object " + remainingObject +" is not in cache; ";
break;
}
}
! // now let's verify that the objects were correctly deleted from the db
! clearCache(mainSession);
! // deleted objects should've disappeared, others remain
! for(int i=0; i < objectsToDelete.size(); i++) {
! Object deletedObject = session.readObject(objectsToDelete.elementAt(i));
! if(deletedObject != null) {
! classErrorMsg = classErrorMsg + "Deleted object "+ deletedObject + " is stil in db; ";
! break;
! }
! }
! for(int i=0; i < objectsLeftAfterOriginalDeletion.size(); i++) {
! Object remainingObject = objectsLeftAfterOriginalDeletion.elementAt(i);
! Object remainingObjectRead = session.readObject(remainingObject);
! if(remainingObjectRead == null) {
! classErrorMsg = classErrorMsg + "Remaining object " + remainingObject +" is not in db; ";
! break;
! }
! }
((AbstractSession)session).rollbackTransaction();
if(classErrorMsg.length() > 0) {
String className = referenceClass.getName();
String shortClassName = className.substring(className.lastIndexOf('.') + 1);
***************
*** 159,165 ****
while(it.hasNext()) {
ClassDescriptor childDescriptor = (ClassDescriptor)it.next();
Class childReferenceClass = childDescriptor.getJavaClass();
! errorMsg += execute(mainSession, childReferenceClass, selectionExpression, shouldDeferExecutionInUOW, handleChildren, reportQuery);
}
}
}
--- 178,184 ----
while(it.hasNext()) {
ClassDescriptor childDescriptor = (ClassDescriptor)it.next();
Class childReferenceClass = childDescriptor.getJavaClass();
! errorMsg += execute(mainSession, childReferenceClass, selectionExpression, shouldDeferExecutionInUOW, handleChildren, rootClass);
}
}
}
***************
*** 170,173 ****
mainSession.getIdentityMapAccessor().initializeAllIdentityMaps();
}
}
-
--- 189,191 ----
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/essentials/oracle/toplink/essentials/testing/tests/cmp3/relationships/CMP3RelationshipsTestModel.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.6
Report generated at Mon Sep 25 15:16:09 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.6 Thu Sep 14 14:27:47 2006
--- /ade/gpelleti_main/tltest/source/essentials/oracle/toplink/essentials/testing/tests/cmp3/relationships/CMP3RelationshipsTestModel.java Mon Sep 25 13:55:11 2006
***************
*** 26,31 ****
--- 26,32 ----
addTest(new NamedQueryWithArgumentsTest());
addTests(JUnitTestCase.suite(EMQueryJUnitTestSuite.class));
addTests(JUnitTestCase.suite(ExpressionJUnitTestSuite.class));
+ addTests(JUnitTestCase.suite(IsolatedCacheTestSuite.class));
}
}
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/resource/essentials/ejb30-testing/META-INF/persistence.xml vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000003/AB0952363AC40CBFE034080020E8C54E.48
Report generated at Mon Sep 25 15:16:09 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000003/AB0952363AC40CBFE034080020E8C54E.48 Thu Sep 14 14:59:47 2006
--- /ade/gpelleti_main/tltest/resource/essentials/ejb30-testing/META-INF/persistence.xml Mon Sep 25 13:55:11 2006
***************
*** 37,46 ****
!
--- 37,47 ----
+
!
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/relationships/RelationshipsTableManager.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.6
Report generated at Mon Sep 25 15:16:09 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.6 Thu Sep 14 16:15:39 2006
--- /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/relationships/RelationshipsTableManager.java Mon Sep 25 13:55:11 2006
***************
*** 33,38 ****
--- 33,39 ----
setName("Relationships");
addTableDefinition(buildCMP3_CUSTOMERTable());
addTableDefinition(buildCMP3_ITEMTable());
+ addTableDefinition(buildCMP3_ISOLATEDITEMTable());
addTableDefinition(buildCMP3_ORDERTable());
addTableDefinition(buildCMP3_ORDER_SEQTable());
addTableDefinition(buildCMP3_SALESPERSONTable());
***************
*** 95,100 ****
--- 96,141 ----
return table;
}
+ public static TableDefinition buildCMP3_ISOLATEDITEMTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_ISOLATED_ITEM");
+
+ FieldDefinition fieldDESCRIPTION = new FieldDefinition();
+ fieldDESCRIPTION.setName("DESCRIPTION");
+ fieldDESCRIPTION.setTypeName("VARCHAR2");
+ fieldDESCRIPTION.setSize(80);
+ fieldDESCRIPTION.setSubSize(0);
+ fieldDESCRIPTION.setIsPrimaryKey(false);
+ fieldDESCRIPTION.setIsIdentity(false);
+ fieldDESCRIPTION.setUnique(false);
+ fieldDESCRIPTION.setShouldAllowNull(true);
+ table.addField(fieldDESCRIPTION);
+
+ FieldDefinition fieldITEM_ID = new FieldDefinition();
+ fieldITEM_ID.setName("ID");
+ fieldITEM_ID.setTypeName("NUMBER");
+ fieldITEM_ID.setSize(15);
+ fieldITEM_ID.setSubSize(0);
+ fieldITEM_ID.setIsPrimaryKey(true);
+ fieldITEM_ID.setIsIdentity(false);
+ fieldITEM_ID.setUnique(false);
+ fieldITEM_ID.setShouldAllowNull(false);
+ table.addField(fieldITEM_ID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR2");
+ fieldNAME.setSize(80);
+ fieldNAME.setSubSize(0);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ return table;
+ }
+
public static TableDefinition buildCMP3_ITEMTable() {
TableDefinition table = new TableDefinition();
table.setName("CMP3_ITEM");
================================================================================
Merge Diffs: /ade/gpelleti_main/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/base/EntityManagerImpl.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000007/AB0952363AC40CBFE034080020E8C54E.41
Report generated at Mon Sep 25 15:16:09 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000007/AB0952363AC40CBFE034080020E8C54E.41 Fri Sep 15 13:45:29 2006
--- /ade/gpelleti_main/tldev/source/essentials/oracle/toplink/essentials/internal/ejb/cmp3/base/EntityManagerImpl.java Mon Sep 25 13:55:11 2006
***************
*** 36,41 ****
--- 36,42 ----
import oracle.toplink.essentials.expressions.Expression;
import oracle.toplink.essentials.internal.ejb.cmp3.transaction.base.TransactionWrapperImpl;
import oracle.toplink.essentials.internal.localization.ExceptionLocalization;
+ import oracle.toplink.essentials.internal.sessions.IsolatedClientSession;
import oracle.toplink.essentials.internal.sessions.MergeManager;
import oracle.toplink.essentials.internal.helper.IdentityHashtable;
import oracle.toplink.essentials.internal.descriptors.OptimisticLockingPolicy;
***************
*** 146,151 ****
--- 147,156 ----
if (this.extendedPersistenceContext != null) {
if (checkForTransaction(false) != null){
this.extendedPersistenceContext.clear();
+
+ if (this.extendedPersistenceContext.getParent() instanceof IsolatedClientSession) {
+ this.extendedPersistenceContext.getParent().getIdentityMapAccessor().initializeIdentityMaps();
+ }
}else{
this.extendedPersistenceContext = null;
}
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/relationships/IsolatedItem.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000009/AB0952363AC40CBFE034080020E8C54E.0
Report generated at Mon Sep 25 15:16:09 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000009/AB0952363AC40CBFE034080020E8C54E.0 Mon Sep 18 10:35:28 2006
--- /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/relationships/IsolatedItem.java Mon Sep 25 13:54:19 2006
***************
*** 0 ****
--- 1,69 ----
+ /*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
+ */
+ // Copyright (c) 1998, 2006, Oracle. All rights reserved.
+ package oracle.toplink.essentials.testing.models.cmp3.relationships;
+
+ import javax.persistence.*;
+ import static javax.persistence.GenerationType.*;
+
+ @Entity
+ @Table(name="CMP3_ISOLATED_ITEM")
+ public class IsolatedItem implements java.io.Serializable {
+ private Integer itemId;
+ private String name;
+ private String description;
+
+ public IsolatedItem() {}
+
+ @Id
+ @GeneratedValue(strategy=TABLE, generator="ISOLATED_ITEM_TABLE_GENERATOR")
+ @TableGenerator(
+ name="ISOLATED_ITEM_TABLE_GENERATOR",
+ table="CMP3_CUSTOMER_SEQ",
+ pkColumnName="SEQ_NAME",
+ valueColumnName="SEQ_COUNT",
+ pkColumnValue="ISOLATED_ITEM_SEQ"
+ )
+ @Column(name="ID")
+ public Integer getItemId() {
+ return itemId;
+ }
+
+ public void setItemId(Integer id) {
+ this.itemId = id;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String desc) {
+ this.description = desc;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ }
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/relationships/IsolatedCacheTestSuite.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000011/AB0952363AC40CBFE034080020E8C54E.0
Report generated at Mon Sep 25 15:16:09 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000011/AB0952363AC40CBFE034080020E8C54E.0 Mon Sep 18 10:35:32 2006
--- /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/relationships/IsolatedCacheTestSuite.java Mon Sep 25 13:54:23 2006
***************
*** 0 ****
--- 1,81 ----
+ /*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * 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.relationships;
+
+ import junit.framework.Test;
+ import junit.framework.TestSuite;
+
+ import javax.persistence.*;
+
+ import oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl;
+ import oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork;
+ import oracle.toplink.essentials.testing.framework.junit.JUnitTestCase;
+ import oracle.toplink.essentials.testing.models.cmp3.relationships.IsolatedItem;
+
+ import oracle.toplink.essentials.testing.models.cmp3.relationships.*;
+
+ public class IsolatedCacheTestSuite extends JUnitTestCase {
+ public IsolatedCacheTestSuite() {}
+
+ public IsolatedCacheTestSuite(String name) {
+ super(name);
+ }
+
+ public void setUp () {
+ super.setUp();
+ new RelationshipsTableManager().replaceTables(JUnitTestCase.getServerSession());
+ }
+
+ public static Test suite() {
+ return new TestSuite(IsolatedCacheTestSuite.class) {
+ protected void setUp(){}
+ protected void tearDown(){}
+ };
+ }
+
+ public void testCacheIsolationDBQueryHit() throws Exception {
+ EntityManager em = createEntityManager();
+
+ // Step 1 - get an isolated item in the cache.
+ em.getTransaction().begin();
+
+ IsolatedItem item = new IsolatedItem();
+ item.setDescription("A phoney item");
+ item.setName("Phoney name");
+ em.persist(item);
+
+ em.getTransaction().commit();
+
+ // Step 2 - clear the entity manager and see if the item still exists
+ // in the uow cache.
+ em.getTransaction().begin();
+
+ em.clear();
+ RepeatableWriteUnitOfWork uow = (RepeatableWriteUnitOfWork) ((EntityManagerImpl) em.getDelegate()).getActivePersistenceContext(em.getTransaction());
+
+ assertFalse("The isolated item was not cleared from the shared cache", uow.getIdentityMapAccessor().containsObjectInIdentityMap(item));
+ assertFalse("The isolated item was not cleared from the uow cache", uow.getParent().getIdentityMapAccessor().containsObjectInIdentityMap(item));
+
+ em.getTransaction().commit();
+ em.close();
+ }
+ }
================================================================================
Merge Diffs: /ade/gpelleti_main/tldev/source/essentials/oracle/toplink/essentials/internal/queryframework/ExpressionQueryMechanism.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000019/AB0952363AC40CBFE034080020E8C54E.27
Report generated at Mon Sep 25 15:16:09 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000019/AB0952363AC40CBFE034080020E8C54E.27 Fri Sep 22 15:57:55 2006
--- /ade/gpelleti_main/tldev/source/essentials/oracle/toplink/essentials/internal/queryframework/ExpressionQueryMechanism.java Mon Sep 25 13:55:11 2006
***************
*** 1001,1017 ****
SQLDeleteStatement deleteStatement;
- // Indicates which kind of sql call should be built:
- // the one containing "EXISTS" or the one containing "NOT EXISTS".
// In Employee example, query with reference class:
// Employee will build "EXISTS" for SALARY and "NOT EXISTS" for EMPLOYEE;
// LargeProject will build "EXISTS" for LPROJECT and "NOT EXISTS" for Project
! boolean useSelectCallForExist = !isSelectCallForNotExistRequired || table.equals((DatabaseTable)tablesInInsertOrder.lastElement());
! if(useSelectCallForExist) {
! // In Employee example, query with reference class:
! // Employee calls this for SALARY table;
! // LargeProject calls this for LPROJECT table;
deleteStatement = buildDeleteAllStatement(table, null, selectCallForExist, selectStatementForExist, null, null, primaryKeyFields);
} else {
if(inheritanceExpression == null) {
// In Employee example, query with reference class Employee calls this for EMPLOYEE table
--- 1001,1034 ----
SQLDeleteStatement deleteStatement;
// In Employee example, query with reference class:
// Employee will build "EXISTS" for SALARY and "NOT EXISTS" for EMPLOYEE;
// LargeProject will build "EXISTS" for LPROJECT and "NOT EXISTS" for Project
! // The situation a more complex if inheritance is involved
! if(!isSelectCallForNotExistRequired) {
deleteStatement = buildDeleteAllStatement(table, null, selectCallForExist, selectStatementForExist, null, null, primaryKeyFields);
+ } else if (table.equals((DatabaseTable)tablesInInsertOrder.lastElement())) {
+ if(inheritanceExpression == null) {
+ // In Employee example, query with reference class:
+ // Employee calls this for SALARY table;
+ deleteStatement = buildDeleteAllStatement(table, null, selectCallForExist, selectStatementForExist, null, null, primaryKeyFields);
+ } else {
+ if(table.equals(getDescriptor().getMultipleTableInsertOrder().firstElement())) {
+ deleteStatement = buildDeleteAllStatement(table, inheritanceExpression, selectCallForExist, selectStatementForExist, null, null, primaryKeyFields);
+ } else {
+ ClassDescriptor desc = getHighestDescriptorMappingTable(table);
+ if(desc == getDescriptor()) {
+ // In Employee example, query with reference class:
+ // LargeProject calls this for LPROJECT table;
+ deleteStatement = buildDeleteAllStatement(table, null, selectCallForExist, selectStatementForExist, null, null, primaryKeyFields);
+ } else {
+ SQLSelectStatement inheritanceSelectStatementForExist = createSQLSelectStatementForModifyAll(null, inheritanceExpression, desc);
+ SQLCall inheritanceSelectCallForExist = (SQLCall)inheritanceSelectStatementForExist.buildCall(getSession());
+
+ deleteStatement = buildDeleteAllStatement(table, null, inheritanceSelectCallForExist, inheritanceSelectStatementForExist, null, null, primaryKeyFields);
+ }
+ }
+ }
} else {
if(inheritanceExpression == null) {
// In Employee example, query with reference class Employee calls this for EMPLOYEE table
***************
*** 1024,1037 ****
// In Employee example, query with reference class LargeProject calls this for PROJECT table
deleteStatement = buildDeleteAllStatement(table, inheritanceExpression, null, null, selectCallForNotExist, selectStatementForNotExist, primaryKeyFields);
} else {
! // find the highest descriptor in inheritance hierarchy mapped to the table
! ClassDescriptor desc = getDescriptor();
! ClassDescriptor parentDescriptor = getDescriptor().getInheritancePolicy().getParentDescriptor();
! while(parentDescriptor.getTables().contains(table)) {
! desc = parentDescriptor;
! parentDescriptor = parentDescriptor.getInheritancePolicy().getParentDescriptor();
! }
!
if(desc == getDescriptor()) {
// Class has multiple tables that are not inherited.
// In extended Employee example:
--- 1041,1047 ----
// In Employee example, query with reference class LargeProject calls this for PROJECT table
deleteStatement = buildDeleteAllStatement(table, inheritanceExpression, null, null, selectCallForNotExist, selectStatementForNotExist, primaryKeyFields);
} else {
! ClassDescriptor desc = getHighestDescriptorMappingTable(table);
if(desc == getDescriptor()) {
// Class has multiple tables that are not inherited.
// In extended Employee example:
***************
*** 2158,2161 ****
--- 2168,2186 ----
public void setSelectionCriteria(Expression expression) {
this.selectionCriteria = expression;
}
+
+ /**
+ * Pass to this method a table mapped by query's descriptor.
+ * Returns the highest descriptor in inheritance hierarchy that mapps this table.
+ */
+ protected ClassDescriptor getHighestDescriptorMappingTable(DatabaseTable table) {
+ // find the highest descriptor in inheritance hierarchy mapped to the table
+ ClassDescriptor desc = getDescriptor();
+ ClassDescriptor parentDescriptor = getDescriptor().getInheritancePolicy().getParentDescriptor();
+ while(parentDescriptor != null && parentDescriptor.getTables().contains(table)) {
+ desc = parentDescriptor;
+ parentDescriptor = parentDescriptor.getInheritancePolicy().getParentDescriptor();
+ }
+ return desc;
+ }
}
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/inheritance/DeleteAllQueryInheritanceJunitTest.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000020/AB0952363AC40CBFE034080020E8C54E.8
Report generated at Mon Sep 25 15:16:09 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000020/AB0952363AC40CBFE034080020E8C54E.8 Mon Sep 25 13:14:51 2006
--- /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/inheritance/DeleteAllQueryInheritanceJunitTest.java Mon Sep 25 13:55:11 2006
***************
*** 118,156 ****
// JUnit framework will automatically execute all methods starting with test...
// The test methods' name pattern is a word "test" followed by underscore and the used selectionExpression:
// test_selectionExpression
- // Each test will test DeleteAllQuery with the specified reference class
- // and all its subclasses
- // Example: for Vehicle.class 9 DeleteAllQueries will be tested.
// ALL Vehicles
public static void test_null() {
! deleteAllQueryInternal(Vehicle.class, null);
}
// ALL Vehicles - nondeferred (execute deleteAllQuery immediately as opposed to during uow.commit)
public static void test_nullNonDeferred() {
! deleteAllQueryInternalNonDeferred(Vehicle.class, null);
}
// Vehicles owned by TOP Company
public static void test_ownerTOP() {
ExpressionBuilder builder = new ExpressionBuilder();
Expression exp = builder.get("owner").get("name").equal("TOP");
! deleteAllQueryInternal(Vehicle.class, exp);
}
// FueledVehicles running on Petrol
public static void test_fuelTypePetrol() {
ExpressionBuilder builder = new ExpressionBuilder();
Expression exp = builder.get("fuelType").equalsIgnoreCase("Petrol");
! deleteAllQueryInternal(FueledVehicle.class, exp);
}
// shchool buses without drivers
public static void test_schoolBusNullDriver() {
ExpressionBuilder builder = new ExpressionBuilder();
Expression exp = builder.get("description").equalsIgnoreCase("School bus").and(builder.get("busDriver").isNull());
! deleteAllQueryInternal(Bus.class, exp);
}
// FueledVehicles owned by Companies that also own NonFueledVehicles
--- 118,153 ----
// JUnit framework will automatically execute all methods starting with test...
// The test methods' name pattern is a word "test" followed by underscore and the used selectionExpression:
// test_selectionExpression
// ALL Vehicles
public static void test_null() {
! deleteAllQueryInternal_Deferred_Children(Vehicle.class, null);
}
// ALL Vehicles - nondeferred (execute deleteAllQuery immediately as opposed to during uow.commit)
public static void test_nullNonDeferred() {
! deleteAllQueryInternal_NonDeferred_Children(Vehicle.class, null);
}
// Vehicles owned by TOP Company
public static void test_ownerTOP() {
ExpressionBuilder builder = new ExpressionBuilder();
Expression exp = builder.get("owner").get("name").equal("TOP");
! deleteAllQueryInternal_Deferred_Children(Vehicle.class, exp);
}
// FueledVehicles running on Petrol
public static void test_fuelTypePetrol() {
ExpressionBuilder builder = new ExpressionBuilder();
Expression exp = builder.get("fuelType").equalsIgnoreCase("Petrol");
! deleteAllQueryInternal_Deferred_Children(FueledVehicle.class, exp);
}
// shchool buses without drivers
public static void test_schoolBusNullDriver() {
ExpressionBuilder builder = new ExpressionBuilder();
Expression exp = builder.get("description").equalsIgnoreCase("School bus").and(builder.get("busDriver").isNull());
! deleteAllQueryInternal_Deferred_Children(Bus.class, exp);
}
// FueledVehicles owned by Companies that also own NonFueledVehicles
***************
*** 164,181 ****
rq.setSelectionCriteria(subExpression);
Expression exp = builder.exists(rq);
! deleteAllQueryInternal(FueledVehicle.class, exp);
}
! protected static void deleteAllQueryInternal(Class referenceClass, Expression selectionExpression) {
! String errorMsg = DeleteAllQueryTestHelper.execute(getDbSession(), referenceClass, selectionExpression);
! if(errorMsg != null) {
! fail(errorMsg);
! }
}
! protected static void deleteAllQueryInternalNonDeferred(Class referenceClass, Expression selectionExpression) {
! String errorMsg = DeleteAllQueryTestHelper.execute(getDbSession(), referenceClass, selectionExpression, false);
if(errorMsg != null) {
fail(errorMsg);
}
--- 161,197 ----
rq.setSelectionCriteria(subExpression);
Expression exp = builder.exists(rq);
! deleteAllQueryInternal_Deferred_Children(FueledVehicle.class, exp);
}
! protected static void deleteAllQueryInternal_Deferred_Children(Class referenceClass, Expression selectionExpression) {
! deleteAllQueryInternal(referenceClass, selectionExpression, true, true);
! }
!
! protected static void deleteAllQueryInternal_NonDeferred_Children(Class referenceClass, Expression selectionExpression) {
! deleteAllQueryInternal(referenceClass, selectionExpression, false, true);
}
! protected static void deleteAllQueryInternal_Deferred_NoChildren(Class referenceClass, Expression selectionExpression) {
! deleteAllQueryInternal(referenceClass, selectionExpression, true, false);
! }
!
! protected static void deleteAllQueryInternal_NonDeferred_NoChildren(Class referenceClass, Expression selectionExpression) {
! deleteAllQueryInternal(referenceClass, selectionExpression, false, false);
! }
!
! // referenceClass - the reference class of DeleteAllQuery to be tested
! // selectionExpression - selection expression of DeleteAllQuery to be tested
! // shouldDeferExecutionInUOW==true causes deferring query execution until uow.commit;
! // shouldDeferExecutionInUOW==false causes immediate query execution;
! // shouldHandleChildren==true means the test will be executed not only with the specified class,
! // but also with all its subclasses.
! // Each test will test DeleteAllQuery with the specified reference class
! // and all its subclasses
! // Example: for Vehicle.class 9 DeleteAllQueries will be tested.
! // shouldHandleChildren==false means the test will be executed with the specified class only.
! protected static void deleteAllQueryInternal(Class referenceClass, Expression selectionExpression, boolean shouldDeferExecutionInUOW, boolean handleChildren) {
! String errorMsg = DeleteAllQueryTestHelper.execute(getDbSession(), referenceClass, selectionExpression, shouldDeferExecutionInUOW, handleChildren);
if(errorMsg != null) {
fail(errorMsg);
}
================================================================================
Merge Diffs: /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/DeleteAllQueryTestHelper.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000021/AB0952363AC40CBFE034080020E8C54E.5
Report generated at Mon Sep 25 15:16:09 2006
--------------------------------------------------------------------------------
*** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/gpelleti/gpelleti_essentials_gf1054_060914/ade_storage/000021/AB0952363AC40CBFE034080020E8C54E.5 Mon Sep 25 13:15:08 2006
--- /ade/gpelleti_main/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/DeleteAllQueryTestHelper.java Mon Sep 25 13:55:11 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;
***************
*** 27,38 ****
import java.util.Vector;
import oracle.toplink.essentials.expressions.Expression;
- import oracle.toplink.essentials.expressions.ExpressionBuilder;
import oracle.toplink.essentials.descriptors.ClassDescriptor;
import oracle.toplink.essentials.internal.sessions.AbstractSession;
import oracle.toplink.essentials.sessions.Session;
import oracle.toplink.essentials.queryframework.DeleteAllQuery;
- import oracle.toplink.essentials.queryframework.ReportQuery;
import oracle.toplink.essentials.sessions.UnitOfWork;
public class DeleteAllQueryTestHelper {
--- 27,36 ----
***************
*** 45,67 ****
return execute(mainSession, referenceClass, selectionExpression, shouldDeferExecutionInUOW, true);
}
public static String execute(Session mainSession, Class referenceClass, Expression selectionExpression, boolean shouldDeferExecutionInUOW, boolean handleChildren) {
- // define a ReportQuery that will be used to check which object left after deletion.
- // In case of inheritance the query will use the utmost parent as a reference class -
- // and will return only PKs.
Class rootClass = referenceClass;
ClassDescriptor descriptor = mainSession.getClassDescriptor(referenceClass);
if(descriptor.hasInheritance()) {
ClassDescriptor parentDescriptor = descriptor;
while(!parentDescriptor.getInheritancePolicy().isRootParentDescriptor()) {
! parentDescriptor = (ClassDescriptor) parentDescriptor.getInheritancePolicy().getParentDescriptor();
}
rootClass = parentDescriptor.getJavaClass();
}
! ReportQuery reportQuery = new ReportQuery(rootClass, new ExpressionBuilder());
! reportQuery.setShouldRetrievePrimaryKeys(true);
!
! String errorMsg = execute(mainSession, referenceClass, selectionExpression, shouldDeferExecutionInUOW, handleChildren, reportQuery);
if(errorMsg.length() == 0) {
return null;
--- 43,76 ----
return execute(mainSession, referenceClass, selectionExpression, shouldDeferExecutionInUOW, true);
}
+ // mainSession - the ServerSession used.
+ // referenceClass - the reference class of DeleteAllQuery to be tested
+ // selectionExpression - selection expression of DeleteAllQuery to be tested
+ // shouldDeferExecutionInUOW==true causes deferring query execution until uow.commit;
+ // shouldDeferExecutionInUOW==false causes immediate query execution;
+ // shouldHandleChildren==true means the test will be executed not only with the specified class,
+ // but also with all its subclasses.
+ // Each test will test DeleteAllQuery with the specified reference class
+ // and all its subclasses
+ // Example: for Vehicle.class 9 DeleteAllQueries will be tested.
+ // shouldHandleChildren==false means the test will be executed with the specified class only.
+ //
+ // For each DeleteAllQuery its results compared with one-by-one deletion:
+ // selectionCriteria is used to select objects and then delete them one-by-one (using uow.deleteObject);
+ // the results are saved and after compared with DeleteAllQuery results:
+ // both inCache and inDb comparison performed;
+ // both deleted and remained objects should be the same;
public static String execute(Session mainSession, Class referenceClass, Expression selectionExpression, boolean shouldDeferExecutionInUOW, boolean handleChildren) {
Class rootClass = referenceClass;
ClassDescriptor descriptor = mainSession.getClassDescriptor(referenceClass);
if(descriptor.hasInheritance()) {
ClassDescriptor parentDescriptor = descriptor;
while(!parentDescriptor.getInheritancePolicy().isRootParentDescriptor()) {
! parentDescriptor = parentDescriptor.getInheritancePolicy().getParentDescriptor();
}
rootClass = parentDescriptor.getJavaClass();
}
! String errorMsg = execute(mainSession, referenceClass, selectionExpression, shouldDeferExecutionInUOW, handleChildren, rootClass);
if(errorMsg.length() == 0) {
return null;
***************
*** 71,77 ****
}
protected static String execute(Session mainSession, Class referenceClass, Expression selectionExpression, boolean shouldDeferExecutionInUOW, boolean handleChildren,
! ReportQuery reportQuery) {
String errorMsg = "";
clearCache(mainSession);
--- 80,86 ----
}
protected static String execute(Session mainSession, Class referenceClass, Expression selectionExpression, boolean shouldDeferExecutionInUOW, boolean handleChildren,
! Class rootClass) {
String errorMsg = "";
clearCache(mainSession);
***************
*** 92,101 ****
mainSession.logMessage("***delete one by one");
uow.commit();
- // pk for the objects left after the original TopLink deletion - one buy one.
- Vector pkLeftAfterOriginalDeletion = (Vector)session.executeQuery(reportQuery);
- // objects left after the original TopLink deletion - one buy one.
- Class rootClass = reportQuery.getReferenceClass();
Vector objectsLeftAfterOriginalDeletion = session.readAllObjects(rootClass);
((AbstractSession)session).rollbackTransaction();
--- 101,106 ----
***************
*** 118,124 ****
DeleteAllQuery query = new DeleteAllQuery(referenceClass, selectionExpression);
query.setShouldDeferExecutionInUOW(shouldDeferExecutionInUOW);
uow.executeQuery(query);
! mainSession.logMessage("***DeleteAllQuery");
uow.commit();
// verify that cache invalidation worked correctly:
--- 123,129 ----
DeleteAllQuery query = new DeleteAllQuery(referenceClass, selectionExpression);
query.setShouldDeferExecutionInUOW(shouldDeferExecutionInUOW);
uow.executeQuery(query);
! mainSession.logMessage("***DeleteAllQuery for class " + referenceClass.getName());
uow.commit();
// verify that cache invalidation worked correctly:
***************
*** 127,152 ****
for(int i=0; i < objectsToDelete.size(); i++) {
Object deletedObject = session.readObject(objectsToDelete.elementAt(i));
if(deletedObject != null) {
! classErrorMsg = classErrorMsg + "Deleted object is stil in cache; ";
break;
}
}
for(int i=0; i < objectsLeftAfterOriginalDeletion.size(); i++) {
! Object remainingObject = session.readObject(objectsLeftAfterOriginalDeletion.elementAt(i));
! if(remainingObject == null) {
! classErrorMsg = classErrorMsg + "Remaining object is not in cache; ";
break;
}
}
! // pk for object left after DeleteAllQuery was executed.
! Vector pkLeftAfterDeleteAllQuery = (Vector)session.executeQuery(reportQuery);
((AbstractSession)session).rollbackTransaction();
- if(!pkLeftAfterOriginalDeletion.equals(pkLeftAfterDeleteAllQuery)) {
- classErrorMsg = "DeleteAllQuery and delete one-by-one results differ; " + classErrorMsg;
- }
if(classErrorMsg.length() > 0) {
String className = referenceClass.getName();
String shortClassName = className.substring(className.lastIndexOf('.') + 1);
--- 132,171 ----
for(int i=0; i < objectsToDelete.size(); i++) {
Object deletedObject = session.readObject(objectsToDelete.elementAt(i));
if(deletedObject != null) {
! classErrorMsg = classErrorMsg + "Deleted object "+ deletedObject +" is stil in cache; ";
break;
}
}
for(int i=0; i < objectsLeftAfterOriginalDeletion.size(); i++) {
! Object remainingObject = objectsLeftAfterOriginalDeletion.elementAt(i);
! Object remainingObjectRead = session.readObject(remainingObject);
! if(remainingObjectRead == null) {
! classErrorMsg = classErrorMsg + "Remaining object " + remainingObject +" is not in cache; ";
break;
}
}
! // now let's verify that the objects were correctly deleted from the db
! clearCache(mainSession);
! // deleted objects should've disappeared, others remain
! for(int i=0; i < objectsToDelete.size(); i++) {
! Object deletedObject = session.readObject(objectsToDelete.elementAt(i));
! if(deletedObject != null) {
! classErrorMsg = classErrorMsg + "Deleted object "+ deletedObject + " is stil in db; ";
! break;
! }
! }
! for(int i=0; i < objectsLeftAfterOriginalDeletion.size(); i++) {
! Object remainingObject = objectsLeftAfterOriginalDeletion.elementAt(i);
! Object remainingObjectRead = session.readObject(remainingObject);
! if(remainingObjectRead == null) {
! classErrorMsg = classErrorMsg + "Remaining object " + remainingObject +" is not in db; ";
! break;
! }
! }
((AbstractSession)session).rollbackTransaction();
if(classErrorMsg.length() > 0) {
String className = referenceClass.getName();
String shortClassName = className.substring(className.lastIndexOf('.') + 1);
***************
*** 159,165 ****
while(it.hasNext()) {
ClassDescriptor childDescriptor = (ClassDescriptor)it.next();
Class childReferenceClass = childDescriptor.getJavaClass();
! errorMsg += execute(mainSession, childReferenceClass, selectionExpression, shouldDeferExecutionInUOW, handleChildren, reportQuery);
}
}
}
--- 178,184 ----
while(it.hasNext()) {
ClassDescriptor childDescriptor = (ClassDescriptor)it.next();
Class childReferenceClass = childDescriptor.getJavaClass();
! errorMsg += execute(mainSession, childReferenceClass, selectionExpression, shouldDeferExecutionInUOW, handleChildren, rootClass);
}
}
}
***************
*** 170,173 ****
mainSession.getIdentityMapAccessor().initializeAllIdentityMaps();
}
}
-
--- 189,191 ----