persistence@glassfish.java.net

Re: String Persistence Strategies

From: James Sutherland <jamesssss_at_yahoo.com>
Date: Mon, 10 Sep 2007 08:48:39 -0700 (PDT)

You can customize the defaults through making your own TopLink
DatabasePlatform class (oracle.toplink.essentials.platform.database).
Subclass your existing database platform class and define the
buildFieldTypes() method to change the default size.

---
http://wiki.java.net/bin/view/People/JamesSutherland James Sutherland 
Shelley wrote:
> 
> Sorry, the default size is 255 [1].  I guess what I am actually looking
> for is a way to customize the default data type for auto schema
> generation.
> 
> If this is not possible, I can define the @Column annotations for each
> field, specify the column definitions in the xml mappings, or manually
> create the DDL/schema, but I would prefer to customize this default
> mapping in one place.
> 
> [1] http://docs.sun.com/app/docs/doc/819-3659/6n5s6m599?a=view#gcmaz
> 
> 
> James Sutherland wrote:
>> 
>> Most databases offer several types to store character (String) data.  The
>> main types are CHAR, VARCHAR and CLOB.  CHAR is for fixed sized data, in
>> Oracle the max size is 2,000, VARCHAR is for variable sized data, in
>> Oracle the max size is 4,000, CLOB is for large data, in Oracle the max
>> size is 4gig.
>> 
>> Check you database for its max sizes, on most databases VARCHAR has a
>> larger max size than 255.  If you think you data may be bigger than the
>> max size for your database then use a CLOB.  VARCHAR is more efficient
>> than a CLOB so only use a CLOB when you really need to.
>> 
> 
> 
-- 
View this message in context: http://www.nabble.com/String-Persistence-Strategies-tf4387515.html#a12596026
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.