Package org.apache.cayenne.dba

Examples of org.apache.cayenne.dba.JdbcAdapter


                Artist.class).getDbEntity(), 5);
        assertFalse(new BatchAction(batch2, adapter, resolver).hasGeneratedKeys());
    }

    DbAdapter buildAdapter(boolean supportGeneratedKeys) {
        JdbcAdapter adapter = new JdbcAdapter();
        adapter.setSupportsGeneratedKeys(supportGeneratedKeys);
        return adapter;
    }
View Full Code Here


                throw new CayenneRuntimeException("Synthetic error....");
            }
        };

        PkGenerator oldGenerator = getNode().getAdapter().getPkGenerator();
        JdbcAdapter adapter = (JdbcAdapter) getNode().getAdapter();

        adapter.setPkGenerator(newGenerator);
        try {
            Artist newArtist = context.newObject(Artist.class);
            newArtist.setArtistName("aaa");
            context.commitChanges();
            fail("Exception expected but not thrown due to missing PK generation routine.");
        }
        catch (CayenneRuntimeException ex) {
            // exception expected
        }
        finally {
            adapter.setPkGenerator(oldGenerator);
        }
    }
View Full Code Here

    public void execute() {

        // prepare defaults
        if (adapter == null) {
            adapter = new JdbcAdapter();
        }

        log("connection settings - [driver: "
                + driver
                + ", url: "
View Full Code Here

    public void execute() {
        configureLogging();

        // prepare defaults
        if (adapter == null) {
            adapter = new JdbcAdapter();
        }

        log("connection settings - [driver: "
                + driver
                + ", url: "
View Full Code Here

            entity.getDataMap().setQuotingSQLIdentifiers(true);
            List idAttributes = Collections.singletonList(entity.getAttribute("LOCKING_TEST_ID"));
            List updatedAttributes = Collections.singletonList(entity.getAttribute("DESCRIPTION"));

            UpdateBatchQuery updateQuery = new UpdateBatchQuery(entity, idAttributes, updatedAttributes, null, 1);
            JdbcAdapter adapter = (JdbcAdapter) this.adapter;

            UpdateBatchQueryBuilder builder = new UpdateBatchQueryBuilder(adapter);
            String generatedSql = builder.createSqlString(updateQuery);

            String charStart = unitAdapter.getIdentifiersStartQuote();
View Full Code Here

            Collection nullAttributes = Collections.singleton("NAME");

            UpdateBatchQuery updateQuery = new UpdateBatchQuery(entity, idAttributes, updatedAttributes,
                    nullAttributes, 1);
            JdbcAdapter adapter = (JdbcAdapter) this.adapter;

            UpdateBatchQueryBuilder builder = new UpdateBatchQueryBuilder(adapter);
            String generatedSql = builder.createSqlString(updateQuery);
            assertNotNull(generatedSql);
View Full Code Here

            entity.getDataMap().setQuotingSQLIdentifiers(true);
            List<DbAttribute> idAttributes = Collections.singletonList((DbAttribute) entity
                    .getAttribute("LOCKING_TEST_ID"));

            DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, null, 1);
            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
            DeleteBatchQueryBuilder builder = new DeleteBatchQueryBuilder(adapter);
            String generatedSql = builder.createSqlString(deleteQuery);

            String charStart = unitAdapter.getIdentifiersStartQuote();
            String charEnd = unitAdapter.getIdentifiersEndQuote();
View Full Code Here

            Collection<String> nullAttributes = Collections.singleton("NAME");

            DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, nullAttributes, 1);

            JdbcAdapter adapter = (JdbcAdapter) this.adapter;

            DeleteBatchQueryBuilder builder = new DeleteBatchQueryBuilder(adapter);
            String generatedSql = builder.createSqlString(deleteQuery);

            String charStart = unitAdapter.getIdentifiersStartQuote();
View Full Code Here

                .getDbEntity();
        try {

            entity.getDataMap().setQuotingSQLIdentifiers(true);

            JdbcAdapter adapter = (JdbcAdapter) this.adapter;

            InsertBatchQuery deleteQuery = new InsertBatchQuery(entity, 1);
            InsertBatchQueryBuilder builder = new InsertBatchQueryBuilder(adapter);
            String generatedSql = builder.createSqlString(deleteQuery);
            String charStart = unitAdapter.getIdentifiersStartQuote();
View Full Code Here

   
    public void testRunAsIndividualQueriesSuccess() throws Exception {
        EntityResolver resolver = runtime.getDataDomain().getEntityResolver();

        // test with adapter that supports keys...
        JdbcAdapter adapter = buildAdapter(true);

        DbEntity dbEntity = resolver
                .getObjEntity(SimpleLockingTestEntity.class)
                .getDbEntity();
View Full Code Here

TOP

Related Classes of org.apache.cayenne.dba.JdbcAdapter

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.