Example usage for org.springframework.dao InvalidDataAccessApiUsageException InvalidDataAccessApiUsageException

List of usage examples for org.springframework.dao InvalidDataAccessApiUsageException InvalidDataAccessApiUsageException

Introduction

In this page you can find the example usage for org.springframework.dao InvalidDataAccessApiUsageException InvalidDataAccessApiUsageException.

Prototype

public InvalidDataAccessApiUsageException(String msg) 

Source Link

Document

Constructor for InvalidDataAccessApiUsageException.

Usage

From source file:com.gzj.tulip.jade.statement.DynamicReturnGeneratedKeys.java

/**
 * DAO??/* w ww  .j  a v  a 2  s  .  c o  m*/
 * 
 * @param returnType DAO????)
 * 
 * @throws InvalidDataAccessApiUsageException DAO??
 */
public void checkMethodReturnType(Class<?> returnType, StatementMetaData metaData) {
    if (returnType != void.class && !Number.class.isAssignableFrom(returnType)) {
        throw new InvalidDataAccessApiUsageException(
                "error return type, only support int/long/double/float/void type for method with @ReturnGeneratedKeys:"
                        + metaData.getMethod());
    }
}

From source file:cc.tooyoung.common.db.ArgTypePreparedStatementSetter.java

/**
 * Create a new ArgTypePreparedStatementSetter for the given arguments.
 * @param args the arguments to set//from w w  w. j a v  a  2 s  . c  o m
 * @param argTypes the corresponding SQL types of the arguments
 */
public ArgTypePreparedStatementSetter(Object[] args, int[] argTypes) {
    if ((args != null && argTypes == null) || (args == null && argTypes != null)
            || (args != null && args.length != argTypes.length)) {
        throw new InvalidDataAccessApiUsageException("args and argTypes parameters must match");
    }
    this.args = args;
    this.argTypes = argTypes;
}

From source file:org.grails.datastore.mapping.jpa.query.JpaQuery.java

public JpaQuery(JpaSession session, PersistentEntity entity) {
    super(session, entity);

    if (session == null) {
        throw new InvalidDataAccessApiUsageException("Argument session cannot be null");
    }//  w w w  . j ava2 s  . com
    if (entity == null) {
        throw new InvalidDataAccessApiUsageException("No persistent entity specified");
    }
}

From source file:com.joyveb.dbpimpl.cass.prepare.mapping.CassandraSimpleTypes.java

public static DataType.Name[] convertPrimitiveTypeArguments(List<TypeInformation<?>> arguments) {
    DataType.Name[] result = new DataType.Name[arguments.size()];
    for (int i = 0; i != result.length; ++i) {
        TypeInformation<?> type = arguments.get(i);
        DataType dataType = autodetectPrimitive(type.getType());
        if (dataType == null) {
            throw new InvalidDataAccessApiUsageException(
                    "not found appropriate primitive DataType for type = '" + type.getType());
        }//from  www  . j a v  a  2s. c  o  m
        result[i] = dataType.getName();
    }
    return result;
}

From source file:com.clican.pluto.common.support.spring.BeanPropertyRowMapper.java

/**
 * Set the class that each row should be mapped to.
 *///  w ww .j  a v  a  2  s  .  c  o m
public void setMappedClass(Class<?> mappedClass) {
    if (this.mappedClass == null) {
        initialize(mappedClass);
    } else {
        if (!this.mappedClass.equals(mappedClass)) {
            throw new InvalidDataAccessApiUsageException("The mapped class can not be reassigned to map to "
                    + mappedClass + " since it is already providing mapping for " + this.mappedClass);
        }
    }
}

From source file:org.grails.datastore.mapping.jpa.JpaSession.java

public Serializable persist(Object o) {
    if (o == null) {
        throw new InvalidDataAccessApiUsageException("Object to persist cannot be null");
    }//  w  w w .j a v  a 2 s .co  m

    final PersistentEntity persistentEntity = getMappingContext().getPersistentEntity(o.getClass().getName());
    if (persistentEntity == null) {
        throw new InvalidDataAccessApiUsageException(
                "Object of class [" + o.getClass().getName() + "] is not a persistent entity");
    }

    jpaTemplate.persist(o);
    return (Serializable) new EntityAccess(persistentEntity, o).getIdentifier();
}

From source file:cn.clickvalue.cv2.model.rowmapper.BeanPropertyRowMapper.java

/**
 * Set the class that each row should be mapped to.
 *//*  w  ww .  j a  v  a2  s .c  o m*/
public void setMappedClass(Class mappedClass) {
    if (this.mappedClass == null) {
        initialize(mappedClass);
    } else {
        if (!this.mappedClass.equals(mappedClass)) {
            throw new InvalidDataAccessApiUsageException("The mapped class can not be reassigned to map to "
                    + mappedClass + " since it is already providing mapping for " + this.mappedClass);
        }
    }
}

From source file:org.grails.datastore.mapping.jpa.JpaSession.java

public Object merge(Object o) {
    if (o == null) {
        throw new InvalidDataAccessApiUsageException("Object to merge cannot be null");
    }/*from   www  . ja v  a2 s  .c o m*/

    final PersistentEntity persistentEntity = getMappingContext().getPersistentEntity(o.getClass().getName());
    if (persistentEntity == null) {
        throw new InvalidDataAccessApiUsageException(
                "Object of class [" + o.getClass().getName() + "] is not a persistent entity");
    }

    return jpaTemplate.merge(o);
}

From source file:com.dexcoder.dal.spring.mapper.JdbcRowMapper.java

/**
 * Set the class that each row should be mapped to.
 *///from www .j  av a2  s.  c  o  m
public void setMappedClass(Class<T> mappedClass) {
    if (this.mappedClass == null) {
        initialize(mappedClass);
    } else {
        if (this.mappedClass != mappedClass) {
            throw new InvalidDataAccessApiUsageException("The mapped class can not be reassigned to map to "
                    + mappedClass + " since it is already providing mapping for " + this.mappedClass);
        }
    }
}