All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xin.xihc.jba.core.bean.JbaMapSqlSource Maven / Gradle / Ivy

There is a newer version: 1.8.12
Show newest version
package xin.xihc.jba.core.bean;

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;

import java.sql.Types;
import java.util.Map;

/**
 * 增加对java枚举类型的支持
 *
 * @author Leo.Xi
 * @date 2018年5月2日
 */
public class JbaMapSqlSource extends MapSqlParameterSource {

	public JbaMapSqlSource(Map values) {
		super(values);
	}

	@Override
	public int getSqlType(String paramName) {
		int sqlType = super.getSqlType(paramName);
		if (sqlType == TYPE_UNKNOWN && hasValue(paramName)) {
			if (null != getValue(paramName) && getValue(paramName).getClass().isEnum()) {
				sqlType = Types.VARCHAR;
			}
		}
		return sqlType;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy