================================================================================ Merge Diffs: /ade/shanchen_toplink_main_temp/tldev/source/essentials/oracle/toplink/essentials/ejb/cmp3/EntityManagerFactoryProvider.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/shanchen/shanchen_11_gf854_061103/ade_storage/000001/AB0952363AC40CBFE034080020E8C54E.51 Report generated at Fri Nov 3 11:22:09 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/shanchen/shanchen_11_gf854_061103/ade_storage/000001/AB0952363AC40CBFE034080020E8C54E.51 Fri Nov 3 10:07:50 2006 --- /ade/shanchen_toplink_main_temp/tldev/source/essentials/oracle/toplink/essentials/ejb/cmp3/EntityManagerFactoryProvider.java Fri Nov 3 11:20:15 2006 *************** *** 38,43 **** --- 38,44 ---- import oracle.toplink.essentials.tools.schemaframework.SchemaManager; import oracle.toplink.essentials.ejb.cmp3.persistence.SEPersistenceUnitInfo; + import oracle.toplink.essentials.exceptions.EntityManagerSetupException; /** * This is the TopLink EJB 3.0 provider *************** *** 117,122 **** --- 118,127 ---- } JavaSECMPInitializer initializer = JavaSECMPInitializer.getJavaSECMPInitializer(nonNullProperties); EntityManagerSetupImpl emSetupImpl = initializer.getEntityManagerSetupImpl(name); + //gf bug 854 Throw an exception if EntityManagerSetupImpl for the name doesn't exist (e.g. a non-existant PU) + if (emSetupImpl == null) { + throw new PersistenceException(EntityManagerSetupException.puNotExist(name)); + } if(emSetupImpl.isUndeployed()) { ((SEPersistenceUnitInfo)emSetupImpl.getPersistenceUnitInfo()).setClassLoader(JavaSECMPInitializer.getMainLoader()); ((SEPersistenceUnitInfo)emSetupImpl.getPersistenceUnitInfo()).setNewTempClassLoader(JavaSECMPInitializer.getMainLoader()); ================================================================================ Merge Diffs: /ade/shanchen_toplink_main_temp/tldev/source/essentials/oracle/toplink/essentials/exceptions/EntityManagerSetupException.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/shanchen/shanchen_11_gf854_061103/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.10 Report generated at Fri Nov 3 11:22:10 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/shanchen/shanchen_11_gf854_061103/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.10 Fri Nov 3 10:08:11 2006 --- /ade/shanchen_toplink_main_temp/tldev/source/essentials/oracle/toplink/essentials/exceptions/EntityManagerSetupException.java Fri Nov 3 11:20:15 2006 *************** *** 39,44 **** --- 39,45 ---- public static final int CANNOT_DEPLOY_WITHOUT_PREDEPLOY = 28013; public static final int FAILED_WHILE_PROCESSING_PROPERTY = 28014; public static final int FAILED_TO_INSTANTIATE_LOGGER = 28015; + public static final int PU_NOT_EXIST = 28016; /** *************** *** 185,188 **** --- 186,197 ---- setupException.setErrorCode(FAILED_TO_INSTANTIATE_LOGGER); return setupException; } + + public static EntityManagerSetupException puNotExist(String puName) { + Object[] args = { puName}; + + EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(EntityManagerSetupException.class, PU_NOT_EXIST, args)); + setupException.setErrorCode(PU_NOT_EXIST); + return setupException; + } } ================================================================================ Merge Diffs: /ade/shanchen_toplink_main_temp/tldev/source/essentials/oracle/toplink/essentials/exceptions/i18n/EntityManagerSetupExceptionResource.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/shanchen/shanchen_11_gf854_061103/ade_storage/000003/AB0952363AC40CBFE034080020E8C54E.14 Report generated at Fri Nov 3 11:22:10 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/shanchen/shanchen_11_gf854_061103/ade_storage/000003/AB0952363AC40CBFE034080020E8C54E.14 Fri Nov 3 10:08:21 2006 --- /ade/shanchen_toplink_main_temp/tldev/source/essentials/oracle/toplink/essentials/exceptions/i18n/EntityManagerSetupExceptionResource.java Fri Nov 3 11:20:15 2006 *************** *** 45,51 **** { "28012", "Value [{0}] is of incorrect type for property [{2}], value type should be [{1}]." }, { "28013", "Attempted to deploy PersistenceUnit [{0}] for which predeploy method either had not called or had failed" }, { "28014", "Exception was thrown while processing property [{0}] with value {[1}]." }, ! { "28015", "Failed to instantiate SessionLog of type [{0}] specified in [{1}] property." } }; /** --- 45,52 ---- { "28012", "Value [{0}] is of incorrect type for property [{2}], value type should be [{1}]." }, { "28013", "Attempted to deploy PersistenceUnit [{0}] for which predeploy method either had not called or had failed" }, { "28014", "Exception was thrown while processing property [{0}] with value {[1}]." }, ! { "28015", "Failed to instantiate SessionLog of type [{0}] specified in [{1}] property." }, ! { "28016", "The persistence unit with name [{0}] does not exist." } }; /** ================================================================================ Merge Diffs: /ade/shanchen_toplink_main_temp/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/shanchen/shanchen_11_gf854_061103/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.57 Report generated at Fri Nov 3 11:22:10 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/shanchen/shanchen_11_gf854_061103/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.57 Fri Nov 3 11:20:05 2006 --- /ade/shanchen_toplink_main_temp/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/EntityManagerJUnitTestSuite.java Fri Nov 3 11:22:09 2006 *************** *** 65,70 **** --- 65,71 ---- import oracle.toplink.essentials.testing.models.cmp3.advanced.Department; import java.util.Iterator; + import oracle.toplink.essentials.exceptions.EntityManagerSetupException; import oracle.toplink.essentials.testing.models.cmp3.advanced.LargeProject; import oracle.toplink.essentials.testing.models.cmp3.advanced.PhoneNumber; import oracle.toplink.essentials.testing.models.cmp3.advanced.SmallProject; *************** *** 2440,2445 **** --- 2441,2462 ---- } } + //GlassFish Bug854 PU name doesn't exist or PU with the wrong name + public void testCreateEntityManagerFactory2() { + EntityManagerFactory emf = null; + + try{ + emf = Persistence.createEntityManagerFactory("default123"); + } catch (Exception e) { + assertTrue("The exception should be an EntityManagerSetupException", e instanceof PersistenceException); + assertTrue("EntityManagerFactoryProvider.createEntityManagerFactory(String emName, Map properties) threw a wrong exception: " + e.getMessage(), ((EntityManagerSetupException)e.getCause()).getErrorCode() == EntityManagerSetupException.PU_NOT_EXIST); + } finally{ + if (emf != null) { + emf.close(); + } + } + } + //Glassfish bug 702 - prevent primary key updates public void testPrimaryKeyUpdate() { EntityManager em = createEntityManager(); ================================================================================ Merge Diffs: /ade/shanchen_toplink_main_temp/tldev/source/essentials/oracle/toplink/essentials/ejb/cmp3/EntityManagerFactoryProvider.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/shanchen/shanchen_11_gf854_061103/ade_storage/000001/AB0952363AC40CBFE034080020E8C54E.51 Report generated at Fri Nov 3 11:23:55 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/shanchen/shanchen_11_gf854_061103/ade_storage/000001/AB0952363AC40CBFE034080020E8C54E.51 Fri Nov 3 10:07:50 2006 --- /ade/shanchen_toplink_main_temp/tldev/source/essentials/oracle/toplink/essentials/ejb/cmp3/EntityManagerFactoryProvider.java Fri Nov 3 11:20:15 2006 *************** *** 38,43 **** --- 38,44 ---- import oracle.toplink.essentials.tools.schemaframework.SchemaManager; import oracle.toplink.essentials.ejb.cmp3.persistence.SEPersistenceUnitInfo; + import oracle.toplink.essentials.exceptions.EntityManagerSetupException; /** * This is the TopLink EJB 3.0 provider *************** *** 117,122 **** --- 118,127 ---- } JavaSECMPInitializer initializer = JavaSECMPInitializer.getJavaSECMPInitializer(nonNullProperties); EntityManagerSetupImpl emSetupImpl = initializer.getEntityManagerSetupImpl(name); + //gf bug 854 Throw an exception if EntityManagerSetupImpl for the name doesn't exist (e.g. a non-existant PU) + if (emSetupImpl == null) { + throw new PersistenceException(EntityManagerSetupException.puNotExist(name)); + } if(emSetupImpl.isUndeployed()) { ((SEPersistenceUnitInfo)emSetupImpl.getPersistenceUnitInfo()).setClassLoader(JavaSECMPInitializer.getMainLoader()); ((SEPersistenceUnitInfo)emSetupImpl.getPersistenceUnitInfo()).setNewTempClassLoader(JavaSECMPInitializer.getMainLoader()); ================================================================================ Merge Diffs: /ade/shanchen_toplink_main_temp/tldev/source/essentials/oracle/toplink/essentials/exceptions/EntityManagerSetupException.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/shanchen/shanchen_11_gf854_061103/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.10 Report generated at Fri Nov 3 11:23:56 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/shanchen/shanchen_11_gf854_061103/ade_storage/000002/AB0952363AC40CBFE034080020E8C54E.10 Fri Nov 3 10:08:11 2006 --- /ade/shanchen_toplink_main_temp/tldev/source/essentials/oracle/toplink/essentials/exceptions/EntityManagerSetupException.java Fri Nov 3 11:20:15 2006 *************** *** 39,44 **** --- 39,45 ---- public static final int CANNOT_DEPLOY_WITHOUT_PREDEPLOY = 28013; public static final int FAILED_WHILE_PROCESSING_PROPERTY = 28014; public static final int FAILED_TO_INSTANTIATE_LOGGER = 28015; + public static final int PU_NOT_EXIST = 28016; /** *************** *** 185,188 **** --- 186,197 ---- setupException.setErrorCode(FAILED_TO_INSTANTIATE_LOGGER); return setupException; } + + public static EntityManagerSetupException puNotExist(String puName) { + Object[] args = { puName}; + + EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(EntityManagerSetupException.class, PU_NOT_EXIST, args)); + setupException.setErrorCode(PU_NOT_EXIST); + return setupException; + } } ================================================================================ Merge Diffs: /ade/shanchen_toplink_main_temp/tldev/source/essentials/oracle/toplink/essentials/exceptions/i18n/EntityManagerSetupExceptionResource.java vs. /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/shanchen/shanchen_11_gf854_061103/ade_storage/000003/AB0952363AC40CBFE034080020E8C54E.14 Report generated at Fri Nov 3 11:23:56 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/shanchen/shanchen_11_gf854_061103/ade_storage/000003/AB0952363AC40CBFE034080020E8C54E.14 Fri Nov 3 10:08:21 2006 --- /ade/shanchen_toplink_main_temp/tldev/source/essentials/oracle/toplink/essentials/exceptions/i18n/EntityManagerSetupExceptionResource.java Fri Nov 3 11:20:15 2006 *************** *** 45,51 **** { "28012", "Value [{0}] is of incorrect type for property [{2}], value type should be [{1}]." }, { "28013", "Attempted to deploy PersistenceUnit [{0}] for which predeploy method either had not called or had failed" }, { "28014", "Exception was thrown while processing property [{0}] with value {[1}]." }, ! { "28015", "Failed to instantiate SessionLog of type [{0}] specified in [{1}] property." } }; /** --- 45,52 ---- { "28012", "Value [{0}] is of incorrect type for property [{2}], value type should be [{1}]." }, { "28013", "Attempted to deploy PersistenceUnit [{0}] for which predeploy method either had not called or had failed" }, { "28014", "Exception was thrown while processing property [{0}] with value {[1}]." }, ! { "28015", "Failed to instantiate SessionLog of type [{0}] specified in [{1}] property." }, ! { "28016", "The persistence unit with name [{0}] does not exist." } }; /** ================================================================================ Merge Diffs: /ade/shanchen_toplink_main_temp/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/shanchen/shanchen_11_gf854_061103/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.57 Report generated at Fri Nov 3 11:23:56 2006 -------------------------------------------------------------------------------- *** /net/stottnfs2.ca.oracle.com/vol/vol1/ade_ottawa_txn/shanchen/shanchen_11_gf854_061103/ade_storage/000004/AB0952363AC40CBFE034080020E8C54E.57 Fri Nov 3 11:20:05 2006 --- /ade/shanchen_toplink_main_temp/tltest/source/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/EntityManagerJUnitTestSuite.java Fri Nov 3 11:22:09 2006 *************** *** 65,70 **** --- 65,71 ---- import oracle.toplink.essentials.testing.models.cmp3.advanced.Department; import java.util.Iterator; + import oracle.toplink.essentials.exceptions.EntityManagerSetupException; import oracle.toplink.essentials.testing.models.cmp3.advanced.LargeProject; import oracle.toplink.essentials.testing.models.cmp3.advanced.PhoneNumber; import oracle.toplink.essentials.testing.models.cmp3.advanced.SmallProject; *************** *** 2440,2445 **** --- 2441,2462 ---- } } + //GlassFish Bug854 PU name doesn't exist or PU with the wrong name + public void testCreateEntityManagerFactory2() { + EntityManagerFactory emf = null; + + try{ + emf = Persistence.createEntityManagerFactory("default123"); + } catch (Exception e) { + assertTrue("The exception should be an EntityManagerSetupException", e instanceof PersistenceException); + assertTrue("EntityManagerFactoryProvider.createEntityManagerFactory(String emName, Map properties) threw a wrong exception: " + e.getMessage(), ((EntityManagerSetupException)e.getCause()).getErrorCode() == EntityManagerSetupException.PU_NOT_EXIST); + } finally{ + if (emf != null) { + emf.close(); + } + } + } + //Glassfish bug 702 - prevent primary key updates public void testPrimaryKeyUpdate() { EntityManager em = createEntityManager();