[ http://jira.andromda.org/browse/CORE-95?page=comments#action_12262 ] Chad Brandon commented on CORE-95: ----------------------------------
All you need to do is create new "String" datatypes in your model. For example, you could create a "datatype::LargeString", "datatype::SmallString", etc and then have those mapped in the mapping file and used where appropriate in your model. > Better handling short, long, very long String types per DB type > --------------------------------------------------------------- > > Key: CORE-95 > URL: http://jira.andromda.org/browse/CORE-95 > Project: AndroMDA Core > Type: Improvement > Reporter: Tomasz Bech > Assignee: Chad Brandon > > Different databases have different support for the varchar type. For example: > Oracle: VARCHAR to 4000, longer texts must be as CLOB > Informix: VARCHAR to 254, longer texts as CLOB or TEXT or LVARCHAR. > But currently there is no way to have one model and several mapping for DB as > there is no conditional mapping in Mapping file. > It would be nice to achieve: > <mapping> > <from>datatype::String</from> > <to>VARCHAR2(255)</to> > <condition>columnLength < 255</condition> > </mapping> > <mapping> > <from>datatype::String</from> > <to>VARCHAR2(4000)</to> > <condition>columnLength <= 4000</condition> > </mapping> > <mapping> > <from>datatype::String</from> > <to>CLOB</to> > <condition>columnLength >4000</condition> > </mapping> > And for Informix database (btw. there is no Informix support currently in > AndorMDA, but the same issue is for PostgreSQL): > <mapping> > <from>datatype::String</from> > <to>VARCHAR2(255)</to> > <condition>columnLength < 255</condition> > </mapping> > <mapping> > <from>datatype::String</from> > <to>LVARCHAR2(32726)</to> > <condition>columnLength <= 32726</condition> > </mapping> > <mapping> > <from>datatype::String</from> > <to>CLOB</to> > <condition>columnLength > 32726</condition> > </mapping> > IMO is should be done in mapping file and not hardcoded in java. The above is > just suggestion, maybe there is simpler way to achieve this feature. ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php