com.activequant.dao.mybatis
Class GenericMapperDao<T extends PersistentEntity>

java.lang.Object
  extended by com.activequant.dao.mybatis.GenericMapperDao<T>
Direct Known Subclasses:
CountryDao, InstrumentDao, MarketDataInstrumentDao, PortfolioDao, PositionDao, RegionDao, SecurityChainDao, TradeableInstrumentDao, VenueDao

public class GenericMapperDao<T extends PersistentEntity>
extends Object


Field Summary
protected  GenericRowMapper mapper
           
 
Constructor Summary
GenericMapperDao(GenericRowMapper mapper, Class<? extends PersistentEntity> clazz, String table)
           
 
Method Summary
 int count()
           
 int countForAttributeValue(String key, Double value)
           
 int countForAttributeValue(String key, Long value)
           
 int countForAttributeValue(String key, String value)
           
 void create(T t)
           
 void delete(T t)
           
 String[] findIDs(int startIndex, int endIndex)
           
 String[] findIDs(String key, Double dValue)
           
 String[] findIDs(String key, Long lValue)
           
 String[] findIDs(String key, String sValue)
           
 String[] findIDsLike(String idsLikeString, int resultAmount)
           
 String[] findIDsWhereCreationDateBetween(TimeStamp startTs, TimeStamp endTs)
           
 String[] findIDsWhereLongValGreater(String fieldName, long sValue)
           
 T load(String primaryKey)
           
 T[] loadAll()
          First sentence: Use with care.
 String[] loadIDs()
          Use this function to load all IDs
 Double[] selectDistinctDoubleVal(String val)
           
 Long[] selectDistinctLongVal(String val)
           
 String[] selectDistinctStringVal(String val)
           
 void update(T t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapper

protected GenericRowMapper mapper
Constructor Detail

GenericMapperDao

public GenericMapperDao(GenericRowMapper mapper,
                        Class<? extends PersistentEntity> clazz,
                        String table)
Method Detail

load

public T load(String primaryKey)

loadAll

public T[] loadAll()
First sentence: Use with care. This will load ALL object instances from DB, which could possibly become a very large table. TODO: find another way to load things, this is too slow.

Returns:
array of ALL instances in persistence layer.

delete

public void delete(T t)

update

public void update(T t)

findIDsWhereCreationDateBetween

public String[] findIDsWhereCreationDateBetween(TimeStamp startTs,
                                                TimeStamp endTs)

loadIDs

public String[] loadIDs()
Use this function to load all IDs

Returns:
a list of all Key-IDs in this set.

create

public void create(T t)

findIDs

public String[] findIDs(String key,
                        String sValue)

findIDsWhereLongValGreater

public String[] findIDsWhereLongValGreater(String fieldName,
                                           long sValue)

findIDs

public String[] findIDs(String key,
                        Double dValue)

findIDs

public String[] findIDs(String key,
                        Long lValue)

findIDs

public String[] findIDs(int startIndex,
                        int endIndex)

findIDsLike

public String[] findIDsLike(String idsLikeString,
                            int resultAmount)

count

public int count()

countForAttributeValue

public int countForAttributeValue(String key,
                                  String value)

countForAttributeValue

public int countForAttributeValue(String key,
                                  Double value)

countForAttributeValue

public int countForAttributeValue(String key,
                                  Long value)

selectDistinctStringVal

public String[] selectDistinctStringVal(String val)

selectDistinctLongVal

public Long[] selectDistinctLongVal(String val)

selectDistinctDoubleVal

public Double[] selectDistinctDoubleVal(String val)


Copyright © 2012 ActiveQuant GmbH. All Rights Reserved.