0

I'm trying to control the length of a BLOB column using the DB2 schema. My final goal is to have hibernatetool generate the SQL file for a 10M long BLOB column, and given the files pasted down here I always get a blob(255). What am I doing wrong?

build.xml (omitted less relevant parts):

<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>

the resulting SQL file is (notice the length of the blob field):

create table CONTENT_STREAM (
  id bigint generated by default as identity, 
  CONTENT blob(255), primary key (id));

Thanks in advance for any help

skuro
  • 13,414
  • 1
  • 48
  • 67
  • 2
    See the answer to [this question](http://stackoverflow.com/q/4809787/192510). You may need to specify the blob length in the column. – NealB Mar 12 '13 at 17:40
  • indeed, mine is a duplicate and should be closed – skuro Mar 12 '13 at 18:26

0 Answers0