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

com.google.sitebricks.persist.sql.SqlEntityStore Maven / Gradle / Ivy

There is a newer version: 0.8.11
Show newest version
package com.google.sitebricks.persist.sql;

import com.google.sitebricks.persist.EntityQuery;
import com.google.sitebricks.persist.EntityStore;
import com.jolbox.bonecp.BoneCP;

import java.io.Serializable;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * @author [email protected] (Dhanji R. Prasanna)
 */
class SqlEntityStore extends EntityStore {
  private final Sql sql;

  public SqlEntityStore(BoneCP pool) {
    try {
      this.sql = new Sql(pool.getConnection());
    } catch (SQLException e) {
      throw new RuntimeException(e);
    }
  }

  @Override
  public  Serializable save(T t) {
    return null;
  }

  @Override
  public  T find(Class type, Serializable key) {
    throw new AssertionError();
  }

  @Override public  List all(Class type) {
    throw new UnsupportedOperationException("Bulk query of all values is not supported by this datastore");
  }

  @Override
  public  void remove(Class type, Serializable key) {
  }

  @Override
  protected  void executeDelete(Class type,
                                   Map> matcherMap) {
  }

  @Override
  protected  List execute(Class type, Map> query,
                                int offset, int limit) {
    throw new UnsupportedOperationException("Bulk query is not supported by this datastore");
  }

  @Override
  public Object delegate() {
    return sql;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy