Search in sources :

Example 21 with DalException

use of com.ctrip.platform.dal.exceptions.DalException in project dal by ctripcorp.

the class KeyHolder method getKeyList.

/**
 * Get all the generated keys for multiple insert.
 * @return all the generated keys
 * @throws DalException
 */
public List<Map<String, Object>> getKeyList() throws DalException {
    if (requireMerge && merged.get() == false)
        throw new DalException(ErrorCode.KeyGenerationFailOrNotCompleted);
    List<Map<String, Object>> keyList = new ArrayList<>();
    int size = size();
    for (int i = 0; i < size; i++) keyList.add(allKeys.get(i));
    return keyList;
}
Also used : DalException(com.ctrip.platform.dal.exceptions.DalException) ArrayList(java.util.ArrayList) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

DalException (com.ctrip.platform.dal.exceptions.DalException)21 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)5 DalHints (com.ctrip.platform.dal.dao.DalHints)4 SelectSqlBuilder (com.ctrip.platform.dal.dao.sqlbuilder.SelectSqlBuilder)3 DalTableDao (com.ctrip.platform.dal.dao.DalTableDao)2 UpdatableEntity (com.ctrip.platform.dal.dao.UpdatableEntity)2 SQLException (java.sql.SQLException)2 Map (java.util.Map)2 StatementParameter (com.ctrip.platform.dal.dao.StatementParameter)1 StatementParameters (com.ctrip.platform.dal.dao.StatementParameters)1 DalConnection (com.ctrip.platform.dal.dao.client.DalConnection)1 DalHA (com.ctrip.platform.dal.dao.client.DalHA)1 LogContext (com.ctrip.platform.dal.dao.client.LogContext)1 DatabaseSet (com.ctrip.platform.dal.dao.configure.DatabaseSet)1 DalShardingStrategy (com.ctrip.platform.dal.dao.strategy.DalShardingStrategy)1 Field (java.lang.reflect.Field)1 Connection (java.sql.Connection)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1