Package org.apache.openjpa.persistence

Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI


     * This test does not take into account and DB specific reserved words and
     * can be run with any DBDictionary.
     * </P>
     */
    public void testSQLKeywords() {
        OpenJPAEntityManagerFactorySPI emf =
            (OpenJPAEntityManagerFactorySPI) Persistence
                    .createEntityManagerFactory("test");
        MappingRepository repos =
                (MappingRepository) emf.getConfiguration()
                        .getMetaDataRepositoryInstance();

        assertEquals("SELECT_ID", repos.getMapping(Inner1.class, null, true)
                .getFieldMapping("select").getColumns()[0].getName());

View Full Code Here


    /**
     * Create sequence so that the test does not require manual intervention in database.
     */
    private void createSequence(String sequence) {
        OpenJPAEntityManagerFactorySPI factorySPI = createEMF();
        OpenJPAEntityManagerSPI em = factorySPI.createEntityManager();

        try {
            em.getTransaction().begin();
            Query q = em.createNativeQuery("CREATE SEQUENCE " + sequence + " START WITH 1");
            q.executeUpdate();
View Full Code Here

    public void setUp() {
    }

    public void testMultipleSchemafactories1() {
        OpenJPAEntityManagerFactorySPI emf =
            createEMF(ResWordEntity.class,
            "openjpa.jdbc.SynchronizeMappings","buildSchema(ForeignKeys=true)",
            "openjpa.jdbc.SchemaFactory","native(ForeignKeys=true)");

        EntityManager em = emf.createEntityManager();
        ResWordEntity pe = new ResWordEntity();

        pe.setId(new Random().nextInt());
        pe.setAlias("AliasVal");
View Full Code Here

        closeEM(em);
        closeEMF(emf);
    }

    public void testMultipleSchemafactories2() {
        OpenJPAEntityManagerFactorySPI emf =
            createEMF(ResWordEntity.class,
            "openjpa.jdbc.SchemaFactory","native(ForeignKeys=true)",
            "openjpa.jdbc.SynchronizeMappings","buildSchema(ForeignKeys=true)");

        EntityManager em = emf.createEntityManager();
        ResWordEntity pe = new ResWordEntity();

        pe.setId(new Random().nextInt());
        pe.setAlias("AliasVal");
View Full Code Here

        closeEM(em);
        closeEMF(emf);
    }

    public void testMultipleSchemafactories3() {
        OpenJPAEntityManagerFactorySPI emf =
            createEMF(ResWordEntity.class,
            "openjpa.jdbc.SynchronizeMappings","buildSchema(ForeignKeys=true)");

        EntityManager em = emf.createEntityManager();
        ResWordEntity pe = new ResWordEntity();

        pe.setId(new Random().nextInt());
        pe.setAlias("AliasVal");
View Full Code Here

        closeEM(em);
        closeEMF(emf);
    }

    public void testMultipleSchemafactories4() {
        OpenJPAEntityManagerFactorySPI emf =
            createEMF(ResWordEntity.class,
            "openjpa.jdbc.SchemaFactory","native(ForeignKeys=true)");

        EntityManager em = emf.createEntityManager();
        ResWordEntity pe = new ResWordEntity();

        pe.setId(new Random().nextInt());
        pe.setAlias("AliasVal");
View Full Code Here

    public void setUp() {
    }


    public void testDerbyDynamicSchema() {
        OpenJPAEntityManagerFactorySPI derbyEMF =
            createEMF(EntityVeryLongNames.class, EntityReservedWords.class,
                "openjpa.ConnectionURL",
                "jdbc:derby:net://host:1527/databaseName",
                "openjpa.jdbc.SynchronizeMappings", "export",
                "openjpa.jdbc.SchemaFactory", "dynamic", RETAIN_DATA);
View Full Code Here

        closeEMF(derbyEMF);
    }


    public void testDB2DynamicSchema() {
        OpenJPAEntityManagerFactorySPI db2EMF =
            createEMF(EntityVeryLongNames.class, EntityReservedWords.class,
                "openjpa.ConnectionURL",
                "jdbc:db2://localhost:5000/db2",
                "openjpa.jdbc.SynchronizeMappings", "export",
                "openjpa.jdbc.SchemaFactory", "dynamic", RETAIN_DATA);
View Full Code Here

        closeEMF(db2EMF);
    }


    public void testOracleDynamicSchema() {
        OpenJPAEntityManagerFactorySPI oracleEMF =
            createEMF(EntityVeryLongNames.class, EntityReservedWords.class,
                "openjpa.ConnectionURL",
                "jdbc:oracle:thin:@host:1234:database_sid",
                "openjpa.jdbc.SynchronizeMappings", "export",
                "openjpa.jdbc.SchemaFactory", "dynamic", RETAIN_DATA);
View Full Code Here

        closeEMF(oracleEMF);
    }


    public void testAccessDynamicSchema() {
        OpenJPAEntityManagerFactorySPI accessEMF =
            createEMF(EntityVeryLongNames.class, EntityReservedWords.class,
                "openjpa.ConnectionURL",
                "jdbc:odbc:Driver=Microsoft Access Driver (*.mdb);DBQ=c:",
                "openjpa.jdbc.SynchronizeMappings", "export",
                "openjpa.jdbc.SchemaFactory", "dynamic", RETAIN_DATA);
View Full Code Here

TOP

Related Classes of org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI

Copyright © 2018 www.massapicom. 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.