我正在尝试使用DB2模式控制BLOB列的长度。我的最终目标是让hibernatetool生成一个10M长的BLOB列的SQL文件,并给出粘贴在这里的文件,我总是得到一个blob(255)。我做错了什么?
build.xml(省略不太相关的部分):
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="toolslib" />
<target name="default">
<hibernatetool destdir="./generated">
<classpath>
<path location="." />
<path location="./classes" />
</classpath>
<configuration configurationfile="hibernate.cfg.xml"/>
<hbm2ddl export="false" outputfilename="sql.ddl"/>
</hibernatetool>
hibernate.cfg.xml中:
<hibernate-configuration>
<session-factory>
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>
<!-- Mapping files -->
<mapping resource="DbContentStream.mapping.xml"/>
</session-factory>
</hibernate-configuration>
DbStreamImpl mapping:
<hibernate-mapping>
<class name="DbContentStreamImpl"
table="CONTENT_STREAM">
<cache usage="read-write"/>
<id name="id" type="java.lang.Long" access="field">
<column name="id"/>
<generator class="native">
</generator>
</id>
<property name="content" type="blob" length="10485760">
<column name="CONTENT"/>
</property>
</class>
</hibernate-mapping>
生成的SQL文件是(注意blob字段的长度):
create table CONTENT_STREAM (
id bigint generated by default as identity,
CONTENT blob(255), primary key (id));
提前感谢您提供任何帮助