Package cc.concurrent.mango.exception

Examples of cc.concurrent.mango.exception.IncorrectDefinitionException


    public void init(@Nullable String table,
                                @Nullable TablePartition tablePartition,
                                @Nullable String shardParameterName,
                                @Nullable String shardPropertyPath) {
        if (tableNode != null && table == null) {
            throw new IncorrectDefinitionException("if sql contains #table, @DB.table must define");
        }
        if (tableNode == null && table != null) {
            throw new IncorrectDefinitionException("if @DB.table is defined, sql must contain #table");
        }
        if (tableNode != null) {
            if ((tablePartition == null && shardParameterName == null && shardPropertyPath == null)
                    || (tablePartition != null && shardParameterName != null && shardPropertyPath != null)) {
                tableNode.setTable(table);
View Full Code Here


    protected DataSource getDataSource(String dsn) {
        final DataSourceFactory dataSourceFactory = dataSourceFactoryHolder.get();
        DataSource ds = dataSourceFactory.getDataSource(dsn, sqlType);
        if (ds == null) {
            throw new IncorrectDefinitionException("can't find datasource for name " + dsn);
        }
        return ds;
    }
View Full Code Here

                    num++;
                }
            }
        }
        if (tablePartition != null && num != 1) {
            throw new IncorrectDefinitionException("if @DB.tablePartition is defined, " +
                    "need one and only one @ShardBy on method's parameter");
        }
        if (num == 1) {
            Type shardType = getTypeContext().getPropertyType(shardParameterName, shardPropertyPath);
            TypeToken typeToken = new TypeToken(shardType);
View Full Code Here

        if (dsrc != null && !dsrc.equals(IgnoreDataSourceRouter.class)) {
            dataSourceRouter = Reflection.instantiate(dsrc);
        }

        if (tablePartition != null && table == null) { // 使用了分表但没有使用全局表名则抛出异常
            throw new IncorrectDefinitionException("if @DB.tablePartition is defined, @DB.table must be defined");
        }

        if (dataSourceRouter != null && tablePartition == null) { // 使用了数据源路由但没有使用分表则抛出异常
            throw new IncorrectDefinitionException("if @DB.dataSourceRouter is defined, " +
                    "@DB.tablePartition must be defined");
        }
    }
View Full Code Here

TOP

Related Classes of cc.concurrent.mango.exception.IncorrectDefinitionException

Copyright © 2018 www.massapicom. 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.