A.5. All Types

The following table shows each of the type classes in the net.sf. hibernate.types package, along with the type name you would use for it in a mapping document, the SQL type used in columns storing mapped values, and any relevant comments about its purpose. In many cases, more detailed discussion can be found earlier. To save space, the "Type" which appears at the end of each class name has been removed, except in the case of the Type interface implemented by all the others.

Type classType nameSQL typeNotes
Abstract-ComponentN/AN/AAbstract ancestor of Component, DynaBean, and Object types
AbstractN/AN/AAbstract skeleton used by the built-in types
ArrayN/AN/AMaps a Java array as a Persistent-Collection
AssociationN/AN/AInterface used by all associations between entities
BagN/AN/AMaps collections with bag semantics
BigDecimalbig_decimalNUMERICIn Oracle, SQL type is NUMBER
BinarybinaryVARBINARYBasic type for byte arrays
BlobblobBLOBNot all drivers support this
BooleanbooleanBITA basic type
BytebyteTINYINTA basic type
CalendarDatecalendar_ dateDATEA basic type
CalendarcalendarTIMESTAMPA basic type
CharBooleanN/ACHARAbstract skeleton used to implement yes_no and true_false types
CharactercharacterCHARA basic and primitive type
ClassclassVARCHAR or VARCHAR2Basic type that stores a class' name
ClobclobCLOBNot all drivers support this
ComponentN/AN/AMaps the properties of a contained value class on to a group of columns
Composite-CustomN/AN/AAdapts CompositeUserType implementations to the Type interface
CurrencycurrencyVARCHAR or VARCHAR2Stores ISO code for a currency
CustomN/AN/AAdapts UserType implementations to the Type interface
DatedateDATEA basic type
DiscriminatorN/AN/AMarker interface for types that can be used for discriminator properties (to select the right mapped subclass)
DoubledoubleDOUBLEA basic and primitive type
DynaBeanN/AN/AMaps Jakarta Commons DynaBeans
EntityN/AN/ARepresents a reference to another entity
FloatfloatFLOATA basic and primitive type
IdentifierBagN/AN/ASupports experimental idbag, mapping a Collection with bag semantics
IdentifierN/AN/AMarker interface for types that store identifiers of entities
ImmutableN/AN/AAbstract superclass for immutable types; extends NullableType
IntegerintegerINTEGERA basic and primitive type
ListN/AN/AMaps a Java List
LiteralN/AN/AMarker interface for types that store SQL literals
LocalelocaleVARCHAR or VARCHAR2Stores ISO code for a locale
LonglongLONGA basic and primitive type
ManyToOneN/AN/AAn association between entities
MapN/AN/AMaps a Java Map
MutableN/AN/AAbstract superclass for mutable types
NullableN/AN/AAbstract superclass for simple, one column types that can be null
ObjectN/AN/AHandles "any" type mappings
OneToOneN/AN/AAn association between entities
Persistent-CollectionN/AN/ASupports persistence of collections and arrays
PersistentEnumN/AN/AMaps persistent enumerations
PrimitiveN/AN/AAbstract skeleton for mapping primitive Java types; extends ImmutableType
SerializableserializableBinary, depends on SQL dialectCatch-all mapping for serializable classes with no better alternative
SetN/AN/AMaps a Java Set
ShortshortSMALLINTA basic and primitive type
SortedMapN/AN/ASorted extension of MapType
SortedSetN/AN/ASorted extension of SetType
StringstringVARCHAR or VARCHAR2A basic and primitive type
TimetimeTIMEA basic type
TimeZonetimezoneVARCHAR or VARCHAR2Stores time zone ID
TimestamptimestampTIMESTAMPA basic type
TrueFalsetrue_falseCHARStores Booleans as "T" or "F"
TypeN/AN/ASuperinterface of all these types
VersionN/AN/AExtends Type for version stamping
YesNoyes_noCHARStores Booleans as "Y" or "N"

There is also a TypeFactory class which provides assistance in building the right Type implementation for a given need, such as when parsing a type name in a mapping document. Reading its source is interesting.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset