Package org.apache.cayenne.dba

Examples of org.apache.cayenne.dba.JdbcAdapter


    @Override
    public void execute() {

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

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


        dataNode.performQueries(Collections.singletonList((Query) query), observer);
        return entity;
    }

    private DataNode createDataNode(DataMap map) {
        JdbcAdapter adapter = (JdbcAdapter) getAccessStackAdapter().getAdapter();
        Collection<DataMap> colection = new ArrayList<DataMap>();
        colection.add(map);
        DataNode dataNode = new DataNode();
        dataNode.setDataMaps(colection);
        dataNode.setAdapter(adapter);
View Full Code Here

import org.apache.cayenne.unit.LockingCase;
import org.apache.cayenne.unit.util.ThreadedTestHelper;

public class SoftDeleteBatchQueryBuilderTest extends LockingCase {
    private DeleteBatchQueryBuilder createBuilder() {
        return createBuilder(new JdbcAdapter());
    }
View Full Code Here

            DeleteBatchQuery deleteQuery = new DeleteBatchQuery(
                    entity,
                    idAttributes,
                    null,
                    1);
            JdbcAdapter adapter = (JdbcAdapter) getAccessStackAdapter().getAdapter();
            DeleteBatchQueryBuilder builder = createBuilder(adapter);
            String generatedSql = builder.createSqlString(deleteQuery);
           
            String charStart = adapter.getIdentifiersStartQuote();
            String charEnd = adapter.getIdentifiersEndQuote();

            assertNotNull(generatedSql);
            assertEquals("UPDATE "
                    + charStart
                    + entity.getName()
View Full Code Here

        assertEquals(0, mockConnection.getNumberCommits());
        assertEquals(0, mockConnection.getNumberRollbacks());
    }

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

                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

        tArtist.insert(201, "artist4", date);
        tArtist.insert(3001, "artist5", date);
    }

    public void testProperties() throws Exception {
        DbAdapter adapter = new JdbcAdapter();
        SQLTemplate template = new SQLTemplate(Object.class, "AAAAA");
        SQLTemplateAction action = new SQLTemplateAction(template, adapter, objectContext
                .getEntityResolver());
        assertSame(adapter, action.getAdapter());
        assertSame(template, action.getQuery());
View Full Code Here

            Template test = new Template() {

                @Override
                void test(SelectTranslator transl) throws Exception {
                    JdbcAdapter adapter = (JdbcAdapter) getAccessStackAdapter()
                            .getAdapter();
                    String charStart = adapter.getIdentifiersStartQuote();
                    String charEnd = adapter.getIdentifiersEndQuote();

                    String s = transl.createSqlString();
                    assertTrue(s.startsWith("SELECT "));
                    int iFrom = s.indexOf(" FROM ");
                    assertTrue(iFrom > 0);
View Full Code Here

            Template test = new Template() {

                @Override
                void test(SelectTranslator transl) throws Exception {

                    JdbcAdapter adapter = (JdbcAdapter) getAccessStackAdapter()
                            .getAdapter();
                    String charStart = adapter.getIdentifiersStartQuote();
                    String charEnd = adapter.getIdentifiersEndQuote();

                    String s = transl.createSqlString();
                   
                    assertTrue(s.startsWith("SELECT "));
                    int iFrom = s.indexOf(" FROM ");
View Full Code Here

            Template test = new Template() {

                @Override
                void test(SelectTranslator transl) throws Exception {
                    JdbcAdapter adapter = (JdbcAdapter) getAccessStackAdapter()
                            .getAdapter();
                    String charStart = adapter.getIdentifiersStartQuote();
                    String charEnd = adapter.getIdentifiersEndQuote();

                   
                    String s = transl.createSqlString();
                   
                    assertTrue(s.startsWith("SELECT DISTINCT "));
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.