Package org.hivedb.hibernate

Source Code of org.hivedb.hibernate.BaseDataAccessObjectFactory

package org.hivedb.hibernate;

import org.hibernate.shards.strategy.access.SequentialShardAccessStrategy;
import org.hivedb.Hive;
import org.hivedb.configuration.EntityHiveConfig;

import java.io.Serializable;
import java.util.Collection;

public class BaseDataAccessObjectFactory<T, ID extends Serializable> implements DataAccessObjectFactory<T, ID> {
 
  Hive hive;
  EntityHiveConfig entityHiveConfig;
  Collection<Class<?>> mappedClasses;
  Class<T> representedClass;
  public BaseDataAccessObjectFactory(EntityHiveConfig entityHiveConfig, Collection<Class<?>> mappedClasses, Class<T> representedClass, Hive hive) {
    this.entityHiveConfig = entityHiveConfig;
    this.mappedClasses = mappedClasses;
    this.representedClass = representedClass;
    this.hive = hive;
  }
  @SuppressWarnings("unchecked")
  public DataAccessObject<T, ID> create() {
    return (DataAccessObject<T, ID>) new BaseDataAccessObject(
        entityHiveConfig.getEntityConfig(representedClass),
        hive,
        new HiveSessionFactoryBuilderImpl(
          entityHiveConfig,
          mappedClasses,
          hive,
          new SequentialShardAccessStrategy()));
  }
}
TOP

Related Classes of org.hivedb.hibernate.BaseDataAccessObjectFactory

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.