Example usage for org.apache.ibatis.exceptions TooManyResultsException TooManyResultsException

List of usage examples for org.apache.ibatis.exceptions TooManyResultsException TooManyResultsException

Introduction

In this page you can find the example usage for org.apache.ibatis.exceptions TooManyResultsException TooManyResultsException.

Prototype

public TooManyResultsException(Throwable cause) 

Source Link

Usage

From source file:com.yimidida.shards.strategy.exit.impl.SelectOneExitStrategy.java

License:Open Source License

@Override
public Object compileResults(ExitOperationsCollector exitOperationsCollector) {
    List<Object> list = exitOperationsCollector.apply(nonNullResult);

    if (list.size() == 1) {
        return list.get(0);
    } else if (list.size() > 1) {
        throw new TooManyResultsException(
                "Expected one result (or null) to be returned by selectOne(), but found: " + list.size());
    } else {//from w  w w. ja  va  2s .com
        return null;
    }
}