On Tue, Apr 15, 2008 at 9:40 AM, Andy Rozman <[EMAIL PROTECTED]> wrote:
> Hi !
>  I am new to derby and I have one question. I am using Hibernate with my
> application and I am having little problems with Derby... (I used same db
> configutaion on PostgreSQL, Mckoi and HsqlDb)...
>  It seems that type text (which should be unlimited varchar) is interpreted
> as CLOB(255). I don't know where this happens but my application now
> fails... Is this Derby problem or Hibernate? I am using latest of Derby
> (10.3.2.1) and Hibernate 3.1.
>
>  Which is longest varchar format in Derby?
>  If someone uses Hibernate with Derby I would be thankful for any help...
>  Andy

We use both Derby and Postgres with Hibernate, so here are a few
ideas.  I guess your hibernate mapping is something like ...
<property name="nbString" type="text">
    <column name="nbString"/>
</property>

CLOB(255) is likely being set by the hibernate "Dialect". (Db2Dialect
I think ??)  The Postgres dialect can have the "text" type, which does
have a limit of around a gig. However Derby is different.  The longest
varchar in derby is 32672 long.  In hibernate you set it thus ...
<property name="nbString" type="string">
    <column name="nbString" length="32672"/>
</property>

Typically you are better off with the string in preference to the CLOB
because you can do more sophisticated text searches in a string than
in a clob. Of course it depends on what you are doing.

HTH
Cheers,
-Damian

Reply via email to