All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jdbishard.dropwizard.testapp.dao.ClientShardDAO Maven / Gradle / Ivy

The newest version!
package jdbishard.dropwizard.testapp.dao;

import org.skife.jdbi.v2.sqlobject.Bind;
import org.skife.jdbi.v2.sqlobject.SqlQuery;
import org.skife.jdbi.v2.sqlobject.SqlUpdate;

import java.util.UUID;

/**
 * A Client information access helper tied to a specific shard. Method access is package-private
 * to prevent accidental use. Use {@link ClientDAO} instead.
 */
public abstract class ClientShardDAO {

    @SqlUpdate("create table client (id uuid primary key, age int)")
    abstract void createClientAgeTable();

    @SqlUpdate("insert into client (id, age) values (:id, :age)")
    abstract void insertClientAge(@Bind("id") UUID id, @Bind("age") int age);

    @SqlQuery("select sum(age) from client")
    abstract int sumClientAge();

    @SqlQuery("select age from client where id = :id")
    abstract int findAgeById(@Bind("id") UUID id);

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy