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

xin.xihc.jba.core.JbaBeanProperty Maven / Gradle / Ivy

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

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

import java.sql.Types;

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

	public JbaBeanProperty(Object object) {
		super(object);
	}

	@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