AttributeConverterSqlTypeDescriptorAdapter.java 文件源码

java
阅读 36 收藏 0 点赞 0 评论 0

项目:lams 作者:
@Override
@SuppressWarnings("unchecked")
public <X> ValueBinder<X> getBinder(JavaTypeDescriptor<X> javaTypeDescriptor) {
    // Get the binder for the intermediate type representation
    final ValueBinder realBinder = delegate.getBinder( intermediateJavaTypeDescriptor );
    return new BasicBinder<X>( javaTypeDescriptor, this ) {
        @Override
        @SuppressWarnings("unchecked")
        protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
            final Object convertedValue;
            try {
                convertedValue = converter.convertToDatabaseColumn( value );
            }
            catch (PersistenceException pe) {
                throw pe;
            }
            catch (RuntimeException re) {
                throw new PersistenceException( "Error attempting to apply AttributeConverter", re );
            }
            realBinder.bind( st, convertedValue, index, options );
        }
    };
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号