Re: Entity Modeler String Data Types
Re: Entity Modeler String Data Types
- Subject: Re: Entity Modeler String Data Types
- From: Art Isbell <email@hidden>
- Date: Wed, 28 May 2008 17:02:44 -1000
On May 28, 2008, at 4:58 PM, Steve Peery wrote:
In Entity Modeler, what is the difference between the String data
types and
when should they be used?
String/Stream - String
String (RTRIM) - String c
String - String S
From the old EOModeler documentation on Value Types:
In EOModeler, the Value Type for an attribute can be set while editing
an attribute in "Table Mode". If the "Value Type" column is not
visible, use the pop-up menu labled "Add Column" in the lower left
corner of the pane.
The Value Type of an attribute in an EOModel controls how the JDBC
adaptor handles important details in its negotiations with the
database. A Value Type is typically a single character.
For attributes with a Value Class of java.lang.Number the following
value types are defined:
b = Byte
s = Short
i = Integer
l = Long
f = Float
d = Double
B = java.math.BigDecimal
c = Boolean
Since java.lang.Number is an abstract superclass, the Value Type
controls which concrete class the JDBC adaptor should instantiate
based on the raw data provided from the database.
It also controls which JDBC methods are used to send and retrieve the
data to and from the database. For attributes with a Value Class of
java.lang.String the following value types are defined:
<none>
c
S
C
E
These Value Types affect which method on the
java.sql.PreparedStatement are used to transfer text data between the
database and the JDBC adaptor. An empty Value Type is backward
compatible behavior with WebObjects v4.5 and uses the setString()
method if the text is less than the database's advertised maximum
varchar length, and setCharacterStream(), if it is too large. If the
database fails to advertise a maximum length, the default is 256
characters. A Value Type of 'S' uses setString() regardless of the
text's length. A Value Type of 'C' uses setCharacterStream()
regardless of the text's length. A Value Type of 'E' converts the text
into raw UTF-8 bytes, and then uses setBinaryStream() to save them in
a binary typed column in the database. The Value Type of 'c' tells the
adaptor to generate SQL using RTRIM to strip off all trailing spaces,
such as those found in CHAR columns.
'S' is appropriate for most text columns. 'C' is good for columns
which usually contain large amounts of data. 'c' should be used when
trailing spaces are not significant in a CHAR column. (It's better to
use a VARCHAR column if possible.) We recommend against using 'E',
except in extreme cases. It is the database's responsibility to handle
text encoding issues, and using 'E' is usually an indication the
database is not correctly configured.
For attributes with a Value Class of NSTimestamp the following value
types are defined:
<none>
D
t
T
M
These value types affect how the data is transfer between the JDBC
adaptor and the database. An empty Value Type uses get/setObject() on
the ResultSet and PreparedStatement. It assumes the database can
provide a value compatible with a java.sql.Timestamp. A 'D' indicates
WebObject's JDBC adaptor should use get/setDate. A 't' indicates get/
setTime(), and a 'T' uses get/setTimestamp(). The 'M' value type is a
workaround for a bug in some MS SQLServer JDBC drivers. It only
support java.sql.Date.
BLOB and CLOB columns are handled specially by the adaptor to support
Oracle. The Value Type has no influence.
Aloha,
Art
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden