Existing EJB converters

Predefined EJB data converters already exist for you to use in mapping your enterprise beans. You can also extend these as superclasses for new converters that you create.

The following list describes the existing converters that you can use in mapping enterprise beans to database columns or when adding a new converter to your EJB project. Most of these existing converters do round-trip conversion, while a few only convert from database column to EJB attribute, but not from EJB attribute to database column. These exceptions are noted.

Typically, the name of the converter indicates the types that are converted, with the database field listed first in the name followed by the EJB attribute. This table attempts to group related converters. Each description lists the database types and EJB attribute types that the converter converts between:

Converter name Description
VapAbstractConverter Main superclass used by all converters.
VapBigDecimalToBooleanConverter Converts a database BigDecimal field to and from a Boolean. Designed specifically for Oracle number types.
VapBigDecimalToDoubleConverter Converts a database BigDecimal field to and from a Double. Designed specifically for Oracle number types.
VapBigDecimalToFloatConverter Converts a database BigDecimal field to and from a FLOAT. Designed specifically for Oracle number types.
VapBigDecimalToIntegerConverter Converts a database BigDecimal field to and from an Integer. Designed specifically for Oracle number types.
VapBigDecimalToLongConverter Converts a database BigDecimal field to and from a Long. Designed specifically for Oracle number types.
VapBigDecimalToShortConverter Converts a database BigDecimal field to and from a Short. Designed specifically for Oracle number types.
VapBigDecimalToStringConverter Converts a database String using java.math.BigDecimal. The BigDecimal is also converted back to a String. Designed specifically for Oracle number types.
VapByteToStringConverter Converts a database Byte to and from a String.
VapCharToBoolean Converts a database Char to a Boolean. Converts a Boolean object to a database Char (Y or N).
VapCharToString Converts a database Char to and from a String.
VapDateToCalendarConverter Convert a database java.sql.Date to a java.util.Calendar object type. Convert java.util.Calendar to a java.sql.Date.
VapDateToTimeConverter Converts a database Date to and from a Time.
VapDateToTimestampConverter Converts a database Date to and from a Timestamp.
VapDoubleToStringConverter Converts a database DOUBLE to and from a String.
VapFloatToStringConverter Converts a database FLOAT to and from a String.
VapIntegerToStringConverter Converts a database Integer to and from a String.
VapLongStringCalendarConverter Extends VapStringCalendarConverter to use the longer format of "yyyy.MM.dd 'at' hh:mm:ss z".
VapLongToStringConverter Converts a database Long to and from a String.
   
Number converters:  
VapNumberToBooleanConverter Extends VapNumberToPrimitiveWrapperConverter. Converts a database primitive Number (0 or 1) to a Boolean (true or false), and converts the Boolean back to a Number.
VapNumberToByteConverter Extends VapNumberToPrimitiveWrapperConverter. Converts a database Number to a Byte. Returns a the byte to the database.
VapNumberToCharacterConverter Extends VapNumberToPrimitiveWrapperConverter. Converts a database Character to and from the unicode value of a Number.
VapNumberToIntegerConverter Extends VapNumberToPrimitiveWrapperConverter. Converts a database Number to an Integer. Returns the Integer back to the database.
VapNumberToLongConverter Extends VapNumberToPrimitiveWrapperConverter. Converts a database Number to a Long. Returns the Long back to the database.
VapNumberToPrimitiveWrapperConverter Superclass used by other number converters. Do not select this converter in the mapping editor.
VapNumberToShortConverter Converts a database Number to a Short. Does not convert the Short back to database Number.
VapNumberToStringConverter Converts a database number (TINYINT, SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE) to a string. Returns the String back to the database. This is a superclass used by other converters.
   
VapShortToStringConverter Converts a database Short to and from a String.
VapStringCalendarConverter Converts a database String to and from a Calendar based on a format pattern of "yyyy.MM.dd".
VapStringToBigDecimalConverter Converts a database String to a BigDecimal value, and converts a BigDecimal value to a database String (VAR or VARCHAR).
   
String to primitive converters:  
VapStringToBooleanConverter Converts a database String to a Boolean (set to true if String equals "Y", "y", "T", "t", or "1", else set to false). Converts a Boolean to a database String (Y or N).
VapStringToByteConverter Converts a database String to and from a Byte.
VapStringToCharacterConverter Converts a database String to and from a Character.
VapStringToDoubleConverter Converts a database String to and from a DOUBLE.
VapStringToFloatConverter Converts a database String to and from a FLOAT.
VapStringToIntegerConverter Converts a database String to and from an Integer.
VapStringToLongConverter Converts a database String to and from a Long.
VapStringToPrimitiveWrapperConverter Superclass used by other String to primitive number converters. Do not use this convert in mappings.
VapStringToShortConverter Converts a database String to and from a Short.
   
VapStringToURLConverter Converts a database String to and from a URL (java.net.URL).
VapStringVarChar Does nothing. Do not use.
VapTimestampToCalendarConverter Converts a database Timestamp to and from a Calendar.
VapTimestampToDateConverter Converts a database Timestamp to and from a java.sql.Date object type.
VapTimestampToTimeConverter Converts a database Timestamp to and from a java.sql.Time object type.
VapTimestampToUtilDateConverter Convert a database java.sql.Timestamp to and from a java.util.Date.
VapTimeToCalendarConverter Converts a database Time to and from a java.util.Calendar object.
VapTrimStringConverter Trims a database String.
   
Stream converters:  
BinaryStreamToEJBHomeConverter Converts a database binary stream to an EJB home interface, and converts the home interface back to a binary stream.

Binary stream converters assume the input to objectFrom(...) is either a byte[], an InputStream, or a Blob. All binary stream converters return a byte[] from dataFrom().

BinaryStreamToEJBObjectConverter Converts a database binary stream to and from an EJB object (javax.ejb.EJBObject)
VapAsciiStreamToObjectConverter Superclass for other ASCII stream converters. Do not use this converter in mappings.

Converts a database String, InputStream or Clob to a String object, and converts the String object back to a database String, InputStream, or Clob. The default for ASCII stream converters is to return a String.

VapAsciiStreamToStringConverter Extends VapAsciiStreamToObjectConverter. Returns the java.lang.String target class name.
VapBinaryStreamToByteArrayConverter Extends VapBinaryStreamToObjectConverter. Includes a method for returning a byte array.
VapBinaryStreamToObjectConverter Superclass for other binary stream converters. Do not use this converter in mappings.

Binary stream converters assume the the input to objectFrom(...) is either a byte[], an InputStream, or a Blob. All binary stream converters return a byte[] from dataFrom().

VapBinaryStreamToSerializableObjectConverter Converts a database InputStream, byte[] or Blob to a deserialized object, and serializes an object to a byte[].
VapStreamToObjectConverter Superclass for other converters. Do not use this converter in mappings.

Extracts a byte[] from an InputStream, and extracts a String from a Clob.

VapUnicodeStreamToObjectConverter Unicode stream converters assume that the database input to objectFrom() is either a String, a Reader, or a Clob. All unicode stream converters return a String.
VapUnicodeStreamToStringConverter Extends VapUnicodeStreamToObjectConverter. Returns java.lang.String target class name.

Feedback