mysql - Persist Text SQL Type via ORMLite (not LONGVARCHAR) -
using datatype.long_string attribute value persisted sql type longvarchar handles longer strings.
however, want map field sql type text .
@databasefield(datatype = datatype.long_string) string comment;
since there difference between longvarchar , text sql type, datatype.long_string value not solve problem
so default long_string
type supposed generate text
schema -- postgres , mysql example. database type using? derby generates long varchar
, hsqldb longvarchar
, , oracle long
. think compatibility reasons.
there couple of ways can override schema ormlite produces. easiest define column columndefinition
part of @databasefield
:
@databasefield(columndefinition = "text") string comment;
if making more complex changes database compability code, can override databasetype
using. in case can override appendlongstringtype(...)
method produce different schema. i'd override derbydatabasetype
or whatever database using , add like:
@override protected void appendlongstringtype(stringbuilder sb, fieldtype fieldtype, int fieldwidth) { sb.append("text"); }
Comments
Post a Comment