/** * DAO for {@link Cube} */ @RegisterMapper(CubeMapper.class) public interface CubeDAO { @SqlQuery("select c.id, c.name, c.query, c.schema_name, c.table_name, c.grouping_column, ds.name" + " as destination from data_sources ds join cubes c on ds.id = c.destination_id " + "where ds.ds_set_id = :ds_set_id") List<Cube> findByDSSetId(@Bind("ds_set_id") long dsSetId); }
/** * DAO for {@link com.qubole.quark.catalog.db.RelSchema.DbDimension} */ @RegisterMapper(DimensionMapper.class) public interface DimensionDAO { @SqlQuery("select name, schema_name, table_name, column_name, " + "cube_column_name, dimension_order, parent_dimension as " + "parent from dimensions where cube_id = :cube_id") List<RelSchema.DbDimension> findByCubeId(@Bind("cube_id") long cubeId); }
/** * DAO for {@link DSSet} */ @RegisterMapper(DSSetMapper.class) public interface DSSetDAO { @SqlQuery("select id, name, default_datasource_id from ds_sets") List<DSSet> findAll(); @SqlQuery("select id, name, default_datasource_id from ds_sets where id = :id") DSSet find(@Bind("id") int id); }
/** * DAO for {@link com.qubole.quark.catalog.db.RelSchema.DbMeasure} */ @RegisterMapper(MeasureMapper.class) public interface MeasureDAO { @SqlQuery("select id, column_name, function, cube_column_name from " + "measures where cube_id = :cube_id") List<RelSchema.DbMeasure> findByCubeId(@Bind("cube_id") long cubeId); }
@RegisterMapper(SomethingMapper.class) interface Cromulence { @SqlQuery Something findById(@Bind("id") Long id); }
@RegisterMapper(MySomethingMapper.class) public static interface Kabob { @SqlUpdate("insert into something (id, name) values (:id, :name)") public void insert(@Bind("id") int id, @Bind("name") String name); @SqlQuery("select id, name from something where id = :id") public Something find(@Bind("id") int id); @SqlQuery("select id, name from something order by id") public List<Something> listAll(); @SqlQuery("select id, name from something order by id") public Iterator<Something> iterateAll(); }
@RegisterMapper(TimestampMapper.class) private interface SomethingSqlDao { @SqlUpdate("insert into something (id, name, created_dt) values (:id, :name, :createdDt)") public void create(@Bind("id") final int id, @Bind("name") final String name, @Bind("createdDt") final DateTime dateTime); @SqlQuery("select created_dt from something where id = :id") public Timestamp getCreatedDt(@Bind("id") final int id); } }
@RegisterMapper(SomethingMapper.class) public static interface DB { @SqlBatch("insert into something (id, name) values(:id, :name)") public void insert(@BindBean Something... things); @SqlQuery("select id, name from something where name = :breakfast.waffle.topping limit 1") public Something findByBreakfast(@BindRoot("breakfast") Breakfast b); }
@RegisterMapper(SomethingMapper.class) public static abstract class Dao { @SqlUpdate("insert into something (id, name) values (:id, :name)") public abstract void insert(@Bind("id") int id, @Bind("name") String name); @SqlQuery("select id, name from something where id = :id") public abstract Something findById(@Bind("id") int id); public Something findByIdHeeHee(int id) { return findById(id); } public abstract void totallyBroken(); }
@RegisterMapper(SomethingMapper.class) public static interface AnotherQuery { @SqlQuery("select id, name from something where id = :id") Something findById(@Bind("id") int id); }
/** * Using an Iterator here means that the results will be loaded lazily, one row at a time * when Iterator#next or Iterator#hasNext is called. See * <a href=""http://jdbi.org/sql_object_api_queries/>SQL Object Queries</a> for more details. * * @return */ @SqlQuery(personWithAddressBaseQuery) @RegisterMapper(PersonWithAddressMapper.class) public abstract Iterator<Person> getAll();
@RegisterMapper(AddonGroupMapper.class) @SqlQuery ( "SELECT * FROM addon WHERE entity_id = :entity.id" ) List<AddonGroup> findAddons(@BindBean("entity") T entity);
@RegisterMapper(AddonGroupMapper.class) @SqlQuery ( "SELECT * FROM addon " + "WHERE entity_id in ( <ids> )" ) List<AddonGroup> findAllAddonsForIds(@BindIn("ids") List<UUID> ids);
/** * @version $Id: 3c846f75122b26a9f1dd1e691fcc5911e1ee545d $ */ @RegisterMapper(PaymentOperationMapper.class) @RegisterArgumentFactory({ MapAsJsonStringArgumentFactory.class, PaymentOperationResultArgumentFactory.class }) @UseStringTemplate3StatementLocator public abstract class PaymentOperationDAO implements Transactional<PaymentOperationDAO> { @SqlUpdate public abstract void createPaymentOperation(@BindBean("operation") PaymentOperation operation); @SqlQuery public abstract List<PaymentOperation> findAllForOrderId(@Bind("orderId") UUID order); }
@RegisterContainerMapper(TestContainerFactory.ImmutableListContainerFactory.class) @RegisterMapper(SomethingMapper.class) public static interface Sql { @SqlBatch("insert into something (id, name) values (:id, :name)") public int[] insert(@Bind("id") Iterable<Integer> ids, @Bind("name") Iterable<String> names); @SqlQuery("select id, name from something where id > :end_of_last_page order by id limit :size") public ImmutableList<Something> loadPage(@Bind("end_of_last_page") int last, @Bind("size") int size); }
@UseStringTemplate3StatementLocator @RegisterMapper(SomethingMapper.class) static interface HoneyBadger { @SqlUpdate("insert into <table> (id, name) values (:id, :name)") public void insert(@Define("table") String table, @BindBean Something s); @SqlQuery("select id, name from <table> where id = :id") public Something findById(@Define("table") String table, @Bind("id") Long id); }
@OverrideStatementRewriterWith(HashPrefixStatementRewriter.class) @RegisterMapper(SomethingMapper.class) static interface Hashed { @SqlUpdate("insert into something (id, name) values (#id, #name)") public void insert(@BindBean Something s); @SqlQuery("select id, name from something where id = #id") public Something findById(@Bind("id") int id); }
@RegisterContainerMapper(TestContainerFactory.ImmutableListContainerFactory.class) @RegisterMapper(SomethingMapper.class) public static interface Sql { @SqlBatch("insert into something (id, name) values (:id, :name)") public int[] insert(@Bind("id") Iterable<Integer> ids, @Bind("name") Iterable<String> names); @SqlQuery("select id, name from something where id > :end_of_last_page order by id limit :size") public ImmutableList<Something> loadPage(@Bind("end_of_last_page") int last, @Bind("size") int size); }
@SqlQuery @RegisterMapper(UuidMapper.class) UUID getAccountIdFromInvoicePaymentId(@Bind("invoicePaymentId") final String invoicePaymentId, @BindBean final InternalTenantContext context);
@SqlQuery("select id, name from something where id = :id") @RegisterMapper(SomethingMapper.class) Something findById(@Bind("id") int id); }