Skip to Main Content
Hibernate: A Developer's Notebook
book

Hibernate: A Developer's Notebook

by James Elliott
May 2004
Intermediate to advanced content levelIntermediate to advanced
192 pages
4h 46m
English
O'Reilly Media, Inc.
Content preview from Hibernate: A Developer's Notebook

A.1. Basic Types

Hibernate's basic types fall into a number of groupings:

Simple numeric and Boolean types

These correspond to the primitive Java types that represent numbers, characters and Boolean values, or their wrapper classes. They get mapped to appropriate SQL column types (based on the SQL dialect in use). They are: boolean, byte, character, double, float, integer, long, short, true_false, and yes_no. The last two are alternate ways to represent a Boolean value within the database; true_false uses the values "T" and "F", while yes_no uses "Y" and "N".

String type

The Hibernate type string maps from java.lang.String to the appropriate string column type for the SQL dialect (usually VARCHAR, but in Oracle VARCHAR2 is used).

Time types

Hibernate uses date, time, and time stampto map from java.util.Date (and subclasses) to appropriate SQL types (e.g.,DATE, TIME, TIMESTAMP).

Arbitrary precision numeric

The Hibernate type big_decimal provides a mapping between java.math.BigDecimal to the appropriate SQL type (usually NUMERIC, but Oracle uses NUMBER).

Localization values

The types locale, timezone, and currency are stored as strings (VARCHAR or VARCHAR2 as noted above), and mapped to the Locale, TimeZone, and Currency classes in the java.util package. Locale and Currency are stored using their ISO codes, while TimeZone is stored using its ID property.

Class names

The type class maps instances of java.lang.Class using their fully qualified names, stored in a string column (VARCHAR, or VARCHAR2 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Getting Started with Hibernate 3

Getting Started with Hibernate 3

James Elliott

Publisher Resources

ISBN: 0596006969Supplemental ContentCatalog PageErrata