Spring-JDBC 常见问题
=====================

大字段的设置--lobHandler
----------------------------

**问题描述：**

大字段的相关设置

**分析与解决方法：**

LobHandler 接口为操作 BLOB/CLOB 提供了统一访问接口，而不管底层数据库究竟是以大对象的方式还是以一般数据类型的方式进行操作。

.. code::

	<bean id="defaultLobHandler"
	 class="org.springframework.jdbc.support.lob.DefaultLobHandler" lazy-init="true"/>


Cannot determine a dialect for org.springframework.jdbc.core
-----------------------------------------------------------------

**问题描述：**

报错：Cannot determine a dialect for org.springframework.jdbc.core

**分析与解决方法：**

.. code::

   org.springframework.data.jdbc.repository.config.DialectResolver$NoDialectException: Cannot determine a dialect for org.springframework.jdbc.core.JdbcTemplate@7c90b7b7. Please provide a Dialect.


堆栈信息：
  
.. code::
  
  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jdbcConverter' defined in class path resource [org/springframework/boot/autoconfigure/data/jdbc/JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration.class]: Unsatisfied dependency expressed through method 'jdbcConverter' parameter 4; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcDialect' defined in class path resource [org/springframework/boot/autoconfigure/data/jdbc/JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.relational.core.dialect.Dialect]: Factory method 'jdbcDialect' threw exception; nested exception is org.springframework.data.jdbc.repository.config.DialectResolver$NoDialectException: Cannot determine a dialect for org.springframework.jdbc.core.JdbcTemplate@7c90b7b7. Please provide a Dialect.


解决办法：
  
  出现该问题是因为使用了spring-boot-starter-data-jdbc包，该包要求提供jdbcDialect，目前未适配，推荐使用spring-boot-starter-jdbc。