hello,
i'm just getting up to speed with hibernate and have been writing some test code but have run into an issue i can't seem to find any documentation on.
here's the mapping for my (ridiculously simple) Resource test class.
Code:
<hibernate-mapping>
<class name="Resource" table="Resources" discriminator-value="R">
<id name="resourceId" column="resourceId" type="int">
<generator class="hilo"/>
</id>
<property name="creationDate" type="long" not-null="true"/>
<property name="categoryId" not-null="true" type="int"/>
<property name="creatorId" not-null="true" type="int"/>
<property name="title" not-null="true" type="string"/>
<property name="description" not-null="true" type="string"/>
<property name="content" type="string"/>
</class>
</hibernate-mapping>
in my test code, i call the following two methods to initialize hibernate:
Code:
public void configure() throws HibernateException
{
sessionFactory = new Configuration()
.addClass(Resource.class)
.buildSessionFactory();
}
public void exportTables() throws HibernateException
{
Configuration cfg = new Configuration()
.addClass(Resource.class);
new SchemaExport(cfg).create(true, true);
}
this has the effect of dropping the existing tables and recreating them which isn't a problem (yet). -however-, the data type for the 'content' member is String (and should be able to handle Strings of any length (> 255)) but during the table recreation, it gets created as a varchar(255). this holds true for all the String data types.
since the 'content' can conceivably be extremely large, i was hoping for a mapping to 'text' or 'bigtext' or something along those lines.
any ideas how i can get hibernate to follow my conception of the String java type to support extremely large string content? also, so i don't write back too quickly, if i want to prevent hibernate from touching existing production tables, how do i disable the dropping/recreating?
thanks in advance for your help!
jason