Package fi.evident.dalesbred

Examples of fi.evident.dalesbred.Database.findUnique()


    public void testCreation() {
        Injector injector = Guice.createInjector(new DriverManagerDatabaseModule(), TestDatabaseProvider.inMemoryDatabasePropertiesModule());

        Database db = injector.getInstance(Database.class);

        Employee employee = db.findUnique(Employee.class, "values (42, 'Fred Foo')");
        assertThat(employee.id, is(42));
        assertThat(employee.name, is("Fred Foo"));
        assertThat(employee.db, is(db));
    }
View Full Code Here


    @Test
    public void defaultDialect() {
        Database db = TestDatabaseProvider.databaseForProperties("hsqldb-connection.properties");

        assertEquals("foo", db.findUnique(String.class, "values ('foo')"));
    }

    @Test
    public void customDialect() {
        Database db = TestDatabaseProvider.databaseForProperties("hsqldb-connection.properties", new UppercaseDialect());
View Full Code Here

        db.update("drop table if exists my_table");
        db.update("create table my_table (text varchar(64))");

        db.update("insert into my_table values (?)", "foo");

        assertEquals("FOO", db.findUnique(String.class, "select text from my_table"));
    }

    private static final class UppercaseDialect extends DefaultDialect {
        @NotNull
        @Override
View Full Code Here

                    tx.setRollbackOnly();
                    return null;
                }
            });

            assertThat(db.findUnique(String.class, "select text from test_table"), is("foo"));

        } finally {
            connection.close();
        }
    }
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.