Hibernate version: 2.1.6 (stable)
Name and version of the database you are using: Microsoft SQLServer 2000 Version 8.00.194 (RTM)
The schema export generates "varbinary(xxx)" if the mapping document specifies "serializable" for a particular field. In SQL server varbinary has a limit of 8000 bytes (less if there is more data on the row). In order to store more than this, the data type should to be "IMAGE" instead of "varbinary(xxx)". After having a quick look at the data type definitions for the dialects, the following modification to SQLServerDialect.java does the trick for me.
Since I am a hibernate newbie, I don't know whether this has other side effects. Anyway, IMHO this may be something that potentially could make it's way into the hibernate source.
Note: Data access on manually created tables that use "serializable" <-> "image" mapping do work without the patch nice and smoothly.
Cheers!
Andy
-------------
andy@earth:~> diff download/hibernate-2.1/src/net/sf/hibernate/dialect/SQLServerDialect.java eclipse/workspace/hibernate-2.1/src/net/sf/hibernate/dialect/SQLServerDialect.java
3a4,5
> import java.sql.Types;
>
9c11,16
<
---
> public SQLServerDialect() {
> super();
> registerColumnType( Types.VARBINARY, "image" );
> registerColumnType( Types.VARBINARY, 8000, "varbinary($l)" );
> }
>
|