Hibernate works quite well with Microsoft SQL Server. However,
if you are doing complex mappings with <joined-subclass>
and reading columns of either TEXT, NTEXT, or IMAGE then you may run
into a problem with the Microsoft JDBC driver where you
get this error:ResultSet can not re-read row data for column
.
The JDBC spec says that:
For maximum portability, columns within a row should be read in left-to-right order, and each column should only be read once. This reflects implementation limitations in some underlying database protocols
The MSJdbcProxy code proxies the connections that Hibernate makes to whatever the underlying connection is, regardless of whether it is a JNDI DataSource, a DBCP pool, or a direct connection. It then caches all reads into a Set, and then reads from that set. This avoids the left to right, once only issue.
To proxy the hibernate connection is very simple. Just add this property to your SessionFactory configuration:
hibernate.connection.provider_class=com.opensourceconnections.msjdbcproxy.HibernateProvider
This class will proxy your connection, delegating to whatever connection type you had previously specified.