Examples of OpenJPAEntityManagerFactorySPI


Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI

    }
   
    public void testExistingColumn() throws SQLException {
        // This test will fail with Oracle JDBC driver version 11.2.0.1.0.
        // It passes with 10.2.0.1.0 (maybe others).
        OpenJPAEntityManagerFactorySPI emf =
            createEMF(XmlColEntity.class,
                "openjpa.jdbc.SchemaFactory", "native",
                "openjpa.jdbc.SynchronizeMappings""");

        JDBCConfiguration conf = ((JDBCConfiguration) emf.getConfiguration());
        DBDictionary dict = conf.getDBDictionaryInstance();

        if (skipTest(dict)) {
            emf.close();
            return;
        }

        EntityManager em = emf.createEntityManager();
        EntityTransaction tran = em.getTransaction();

        XmlColEntity xce = em.find(XmlColEntity.class, 42);
        assertNotNull(xce);
        assertNotNull(xce.getXmlColumn());
        assertEquals(xmlData, xce.getXmlColumn());
        em.close();
        emf.close();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI

   
    /**
     * Validates use of access specifier of FIELD in entity-mappings.
     */
    public void testEMDefaultFieldAccess() {
        OpenJPAEntityManagerFactorySPI emf1 =
            (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
            createEntityManagerFactory("Access-EMFldDef",
            "org/apache/openjpa/persistence/access/" +
            "access-def-persistence.xml");
       
        OpenJPAEntityManagerSPI em = emf1.createEntityManager();
        verifyDefaultFieldAccess(em);
                       
        em.close();
        clear(emf1);
        closeEMF(emf1);
View Full Code Here

Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI

    /**
     * Validates use of access specifier of PROPERTY in entity-mappings.
     */
    public void testEMDefaultPropertyAccess() {
        OpenJPAEntityManagerFactorySPI emf1 =
            (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
            createEntityManagerFactory("Access-EMPropDef",
            "org/apache/openjpa/persistence/access/" +
            "access-def-persistence.xml");
       
        OpenJPAEntityManagerSPI em = emf1.createEntityManager();
        verifyDefaultPropertyAccess(em);

        em.close();
        clear(emf1);
        closeEMF(emf1);
View Full Code Here

Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI

    /**
     * Validates use of access specifier of FIELD in persistence unit defaults.
     */
    public void testPUDefaultFieldAccess() {
        OpenJPAEntityManagerFactorySPI emf1 =
            (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
            createEntityManagerFactory("Access-PUFldDef",
            "org/apache/openjpa/persistence/access/" +
            "access-pudef-persistence.xml");
       
        OpenJPAEntityManagerSPI em = emf1.createEntityManager();
        verifyDefaultFieldAccess(em);
                       
        em.close();
        clear(emf1);
        closeEMF(emf1);
View Full Code Here

Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI

    /**
     * Validates use of access specifier of PROPERTY in persistence unit
     * defaults.
     */
    public void testPUDefaultPropertyAccess() {
        OpenJPAEntityManagerFactorySPI emf1 =
            (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
            createEntityManagerFactory("Access-PUPropDef",
            "org/apache/openjpa/persistence/access/" +
            "access-pudef-persistence.xml");
       
        OpenJPAEntityManagerSPI em = emf1.createEntityManager();
        verifyDefaultPropertyAccess(em);

        em.close();
        clear(emf1);
        closeEMF(emf1);
View Full Code Here

Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI

public class TestTimeoutException extends SingleEMFTestCase {
    private final Class<?> entityClass = PObject.class;

    public void setUp() {
        // Disable tests for any DB that has supportsSelectForUpdate==false, like HSQLDictionary
        OpenJPAEntityManagerFactorySPI tempEMF = emf;
        if (tempEMF == null) {
            tempEMF = createEMF();
        }
        assertNotNull(tempEMF);
        DBDictionary dict = ((JDBCConfiguration)tempEMF.getConfiguration()).getDBDictionaryInstance();
        assertNotNull(dict);
        if (!dict.supportsSelectForUpdate || !dict.supportsQueryTimeout || dict instanceof SolidDBDictionary)
            setTestsDisabled(true);
        if (emf == null) {
            closeEMF(tempEMF);
View Full Code Here

Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI

    };


    public void testCacheMarshallerEndToEnd()
        throws IOException {
        OpenJPAEntityManagerFactorySPI emf = createEMF(STORE_PROPS);
        CacheMarshallerImpl cm = (CacheMarshallerImpl)
            CacheMarshallersValue.getMarshallerById(
            emf.getConfiguration(), MetaDataCacheMaintenance.class.getName());
        cm.getOutputFile().delete();
        MetaDataCacheMaintenance maint = new MetaDataCacheMaintenance(
            JPAFacadeHelper.toBrokerFactory(emf), false);
        LogImpl log = new LogImpl();
        maint.setLog(log);
        maint.store();
        assertContains(log.lines, "    " + AllFieldTypes.class.getName());
        assertContains(log.lines, "    " + NamedQueryEntity.class.getName());
        assertContains(log.lines, "    NamedQueryEntity.namedQuery");
        clear(emf);
        closeEMF(emf);

        emf = createEMF(LOAD_PROPS);
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        em.persist(new NamedQueryEntity("foo"));
        em.flush();
        Query q = em.createNamedQuery("NamedQueryEntity.namedQuery");
        assertEquals(1, q.getResultList().size());
View Full Code Here

Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI

    /**
     * Validates that a mapped superclass using field access and an entity
     * subclass using property access get mapped properly.
     */
    public void testAbstractMappedSuperField() {
        OpenJPAEntityManagerFactorySPI emf1 =
            (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
            createEntityManagerFactory("Access-XML",
            "org/apache/openjpa/persistence/access/" +
            "access-persistence.xml");

        OpenJPAEntityManagerSPI em = emf1.createEntityManager();

        XMLPropertySub ps = new XMLPropertySub();
        // Call super setter with underlying field access
        ps.setName("AbsMappedSuperName");
        // Call base setter with property access
View Full Code Here

Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI

     * Validates that a mapped superclass using property access and an entity
     * subclass using field access get mapped properly.
     */
    public void testAbstractMappedSuperProperty() {

        OpenJPAEntityManagerFactorySPI emf1 =
            (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
            createEntityManagerFactory("Access-XML",
            "org/apache/openjpa/persistence/access/" +
            "access-persistence.xml");

        OpenJPAEntityManagerSPI em = emf1.createEntityManager();
       
        XMLFieldSub fs = new XMLFieldSub();
        // Call super setter with underlying field access
        fs.setName("AbsMappedSuperName");
        // Call base setter with property access
View Full Code Here

Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI

     * entity subclass using property access get mapped properly.
     * The subclass uses a storage field in the superclass.
     */
    public void testMappedSuperField() {
       
        OpenJPAEntityManagerFactorySPI emf1 =
            (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
            createEntityManagerFactory("Access-XML",
            "org/apache/openjpa/persistence/access/" +
            "access-persistence.xml");

        OpenJPAEntityManagerSPI em = emf1.createEntityManager();
       
        XMLPropertySub2 ps = new XMLPropertySub2();
        // Call super setter with underlying field access
        ps.setName("MappedSuperName");
        // Call base setter with property access
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.