The Hibernate type system maps Java property types to SQL types. The configured SQL dialect determines the database-specific column type used for schema generation; for example, H2Dialect maps ANSI NUMERIC to DECIMAL. section 6.3.1
Mapping parameters influence the generated schema. A BigDecimal defaults to NUMERIC(19, 2); use @Column precision and scale to change it. A String defaults to VARCHAR(255), while @Column(length = ...) or Bean Validation’s @Length can affect type selection. For nationalized character types, use @Nationalized. section 6.3.1
String length and MySQL
With the MySQL dialect, a declared length up to 65,535 generates VARCHAR(length); a length up to 16,777,215 generates MEDIUMTEXT, and greater lengths use LONGTEXT. Extending the dialect can customize this selection. section 6.3.1
Boolean stored as a character
Annotate a boolean property with @org.hibernate.annotations.Type(type = "yes_no") to use the built-in CHAR(1) representation, with 'Y' or 'N' values. section 6.3.1
Table 6.1 Java primitive types that map to SQL standard types (view table figure)
Compare built-in numeric and boolean Java types with their ANSI SQL mappings. section 6.3.1
Table 6.2 Adapters for character and string values (view table figure)
Compare string and character adapters, including boolean representations. section 6.3.1
